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
|
@@ -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,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 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): IBoundedElement;
|
|
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
|
+
gapForElement(state: object, defaultGap: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Disposes of the given label.
|
|
31
|
+
*
|
|
32
|
+
* @param element The flyout label to dispose of.
|
|
33
|
+
*/
|
|
34
|
+
disposeElement(element: IBoundedElement): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=label_flyout_inflater.d.ts.map
|
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
|
*
|
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/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';
|
|
@@ -53,16 +51,26 @@ export declare class Renderer implements IRegistrable {
|
|
|
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.
|
|
@@ -102,7 +102,13 @@ export declare class ConstantProvider extends BaseConstantProvider {
|
|
|
102
102
|
* rectangular reporter block. Null before init is called.
|
|
103
103
|
*/
|
|
104
104
|
SQUARED: Shape | null;
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new ConstantProvider.
|
|
107
|
+
*
|
|
108
|
+
* @param gridUnit If set, defines the base unit used to calculate other
|
|
109
|
+
* constants.
|
|
110
|
+
*/
|
|
111
|
+
constructor(gridUnit?: number);
|
|
106
112
|
setFontConstants_(theme: Theme): void;
|
|
107
113
|
init(): void;
|
|
108
114
|
setDynamicProperties_(theme: Theme): void;
|
|
@@ -153,7 +159,7 @@ export declare class ConstantProvider extends BaseConstantProvider {
|
|
|
153
159
|
};
|
|
154
160
|
generateSecondaryColour_(colour: string): string;
|
|
155
161
|
generateTertiaryColour_(colour: string): string;
|
|
156
|
-
createDom(svg: SVGElement, tagName: string, selector: string): void;
|
|
162
|
+
createDom(svg: SVGElement, tagName: string, selector: string, injectionDivIfIsParent?: HTMLElement): void;
|
|
157
163
|
getCSS_(selector: string): string[];
|
|
158
164
|
}
|
|
159
165
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
7
|
-
import { InsertionMarkerManager } from '../../insertion_marker_manager.js';
|
|
8
7
|
import type { Marker } from '../../keyboard_nav/marker.js';
|
|
9
|
-
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
10
8
|
import type { BlockStyle } from '../../theme.js';
|
|
11
9
|
import type { WorkspaceSvg } from '../../workspace_svg.js';
|
|
12
10
|
import type { RenderInfo as BaseRenderInfo } from '../common/info.js';
|
|
@@ -73,10 +71,5 @@ export declare class Renderer extends BaseRenderer {
|
|
|
73
71
|
* @returns The constant provider.
|
|
74
72
|
*/
|
|
75
73
|
getConstants(): ConstantProvider;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated v10 - This function is no longer respected. A custom
|
|
78
|
-
* IConnectionPreviewer may be able to fulfill the functionality.
|
|
79
|
-
*/
|
|
80
|
-
getConnectionPreviewMethod(closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg): InsertionMarkerManager.PREVIEW_TYPE;
|
|
81
74
|
}
|
|
82
75
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
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 separators for flyouts.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SeparatorFlyoutInflater implements IFlyoutInflater {
|
|
13
|
+
/**
|
|
14
|
+
* Inflates a dummy flyout separator.
|
|
15
|
+
*
|
|
16
|
+
* The flyout automatically creates separators between every element with a
|
|
17
|
+
* size determined by calling gapForElement on the relevant inflater.
|
|
18
|
+
* Additionally, users can explicitly add separators in the flyout definition.
|
|
19
|
+
* When separators (implicitly or explicitly created) follow one another, the
|
|
20
|
+
* gap of the last one propagates backwards and flattens to one separator.
|
|
21
|
+
* This flattening is not additive; if there are initially separators of 2, 3,
|
|
22
|
+
* and 4 pixels, after normalization there will be one separator of 4 pixels.
|
|
23
|
+
* Therefore, this method returns a zero-width separator, which will be
|
|
24
|
+
* replaced by the one implicitly created by the flyout based on the value
|
|
25
|
+
* returned by gapForElement, which knows the default gap, unlike this method.
|
|
26
|
+
*
|
|
27
|
+
* @param _state A JSON representation of a flyout separator.
|
|
28
|
+
* @param flyoutWorkspace The workspace the separator belongs to.
|
|
29
|
+
* @returns A newly created FlyoutSeparator.
|
|
30
|
+
*/
|
|
31
|
+
load(_state: object, flyoutWorkspace: WorkspaceSvg): IBoundedElement;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the size of the separator. See `load` for more details.
|
|
34
|
+
*
|
|
35
|
+
* @param state A JSON representation of a flyout separator.
|
|
36
|
+
* @param defaultGap The default spacing for flyout items.
|
|
37
|
+
* @returns The desired size of the separator.
|
|
38
|
+
*/
|
|
39
|
+
gapForElement(state: object, defaultGap: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Disposes of the given separator. Intentional no-op.
|
|
42
|
+
*
|
|
43
|
+
* @param _element The flyout separator to dispose of.
|
|
44
|
+
*/
|
|
45
|
+
disposeElement(_element: IBoundedElement): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=separator_flyout_inflater.d.ts.map
|
|
@@ -4,15 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { ISerializer } from '../interfaces/i_serializer.js';
|
|
7
|
+
import type { IVariableState } from '../interfaces/i_variable_model.js';
|
|
7
8
|
import type { Workspace } from '../workspace.js';
|
|
8
|
-
/**
|
|
9
|
-
* Represents the state of a given variable.
|
|
10
|
-
*/
|
|
11
|
-
export interface State {
|
|
12
|
-
name: string;
|
|
13
|
-
id: string;
|
|
14
|
-
type: string | undefined;
|
|
15
|
-
}
|
|
16
9
|
/**
|
|
17
10
|
* Serializer for saving and loading variable state.
|
|
18
11
|
*/
|
|
@@ -26,7 +19,7 @@ export declare class VariableSerializer implements ISerializer {
|
|
|
26
19
|
* @returns The state of the workspace's variables, or null if there are no
|
|
27
20
|
* variables.
|
|
28
21
|
*/
|
|
29
|
-
save(workspace: Workspace):
|
|
22
|
+
save(workspace: Workspace): IVariableState[] | null;
|
|
30
23
|
/**
|
|
31
24
|
* Deserializes the variable defined by the given state into the given
|
|
32
25
|
* workspace.
|
|
@@ -34,7 +27,7 @@ export declare class VariableSerializer implements ISerializer {
|
|
|
34
27
|
* @param state The state of the variables to deserialize.
|
|
35
28
|
* @param workspace The workspace to deserialize into.
|
|
36
29
|
*/
|
|
37
|
-
load(state:
|
|
30
|
+
load(state: IVariableState[], workspace: Workspace): void;
|
|
38
31
|
/**
|
|
39
32
|
* Disposes of any variables that exist on the workspace.
|
|
40
33
|
*
|
|
@@ -36,8 +36,6 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
36
36
|
protected contentsDiv_: HTMLDivElement | null;
|
|
37
37
|
/** Whether the Toolbox is visible. */
|
|
38
38
|
protected isVisible_: boolean;
|
|
39
|
-
/** The list of items in the toolbox. */
|
|
40
|
-
protected contents_: IToolboxItem[];
|
|
41
39
|
/** The width of the toolbox. */
|
|
42
40
|
protected width_: number;
|
|
43
41
|
/** The height of the toolbox. */
|
|
@@ -45,9 +43,8 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
45
43
|
RTL: boolean;
|
|
46
44
|
/** The flyout for the toolbox. */
|
|
47
45
|
private flyout;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
46
|
+
/** Map from ID to the corresponding toolbox item. */
|
|
47
|
+
protected contents: Map<string, IToolboxItem>;
|
|
51
48
|
toolboxPosition: toolbox.Position;
|
|
52
49
|
/** The currently selected item. */
|
|
53
50
|
protected selectedItem_: ISelectableToolboxItem | null;
|
package/core/variable_map.d.ts
CHANGED
|
@@ -11,17 +11,18 @@
|
|
|
11
11
|
import './events/events_var_delete.js';
|
|
12
12
|
import './events/events_var_rename.js';
|
|
13
13
|
import type { Block } from './block.js';
|
|
14
|
-
import {
|
|
14
|
+
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
15
|
+
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
15
16
|
import type { Workspace } from './workspace.js';
|
|
16
17
|
/**
|
|
17
18
|
* Class for a variable map. This contains a dictionary data structure with
|
|
18
19
|
* variable types as keys and lists of variables as values. The list of
|
|
19
20
|
* variables are the type indicated by the key.
|
|
20
21
|
*/
|
|
21
|
-
export declare class VariableMap {
|
|
22
|
+
export declare class VariableMap implements IVariableMap<IVariableModel<IVariableState>> {
|
|
22
23
|
workspace: Workspace;
|
|
23
24
|
/**
|
|
24
|
-
* A map from variable type to
|
|
25
|
+
* A map from variable type to map of IDs to variables. The maps contain
|
|
25
26
|
* all of the named variables in the workspace, including variables that are
|
|
26
27
|
* not currently in use.
|
|
27
28
|
*/
|
|
@@ -35,13 +36,15 @@ export declare class VariableMap {
|
|
|
35
36
|
*
|
|
36
37
|
* @param variable Variable to rename.
|
|
37
38
|
* @param newName New variable name.
|
|
38
|
-
* @
|
|
39
|
+
* @returns The newly renamed variable.
|
|
39
40
|
*/
|
|
40
|
-
renameVariable(variable:
|
|
41
|
+
renameVariable(variable: IVariableModel<IVariableState>, newName: string): IVariableModel<IVariableState>;
|
|
42
|
+
changeVariableType(variable: IVariableModel<IVariableState>, newType: string): IVariableModel<IVariableState>;
|
|
41
43
|
/**
|
|
42
44
|
* Rename a variable by updating its name in the variable map. Identify the
|
|
43
45
|
* variable to rename with the given ID.
|
|
44
46
|
*
|
|
47
|
+
* @deprecated v12, use VariableMap.renameVariable.
|
|
45
48
|
* @param id ID of the variable to rename.
|
|
46
49
|
* @param newName New variable name.
|
|
47
50
|
*/
|
|
@@ -78,29 +81,27 @@ export declare class VariableMap {
|
|
|
78
81
|
* @param opt_id The unique ID of the variable. This will default to a UUID.
|
|
79
82
|
* @returns The newly created variable.
|
|
80
83
|
*/
|
|
81
|
-
createVariable(name: string, opt_type?: string
|
|
84
|
+
createVariable(name: string, opt_type?: string, opt_id?: string): IVariableModel<IVariableState>;
|
|
82
85
|
/**
|
|
83
|
-
*
|
|
86
|
+
* Adds the given variable to this variable map.
|
|
87
|
+
*
|
|
88
|
+
* @param variable The variable to add.
|
|
89
|
+
*/
|
|
90
|
+
addVariable(variable: IVariableModel<IVariableState>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Delete a variable and all of its uses without confirmation.
|
|
84
93
|
*
|
|
85
94
|
* @param variable Variable to delete.
|
|
86
95
|
*/
|
|
87
|
-
deleteVariable(variable:
|
|
96
|
+
deleteVariable(variable: IVariableModel<IVariableState>): void;
|
|
88
97
|
/**
|
|
89
98
|
* Delete a variables by the passed in ID and all of its uses from this
|
|
90
99
|
* workspace. May prompt the user for confirmation.
|
|
91
100
|
*
|
|
101
|
+
* @deprecated v12, use Blockly.Variables.deleteVariable.
|
|
92
102
|
* @param id ID of variable to delete.
|
|
93
103
|
*/
|
|
94
104
|
deleteVariableById(id: string): void;
|
|
95
|
-
/**
|
|
96
|
-
* Deletes a variable and all of its uses from this workspace without asking
|
|
97
|
-
* the user for confirmation.
|
|
98
|
-
*
|
|
99
|
-
* @param variable Variable to delete.
|
|
100
|
-
* @param uses An array of uses of the variable.
|
|
101
|
-
* @internal
|
|
102
|
-
*/
|
|
103
|
-
deleteVariableInternal(variable: VariableModel, uses: Block[]): void;
|
|
104
105
|
/**
|
|
105
106
|
* Find the variable by the given name and type and return it. Return null if
|
|
106
107
|
* it is not found.
|
|
@@ -110,14 +111,14 @@ export declare class VariableMap {
|
|
|
110
111
|
* the empty string, which is a specific type.
|
|
111
112
|
* @returns The variable with the given name, or null if it was not found.
|
|
112
113
|
*/
|
|
113
|
-
getVariable(name: string, opt_type?: string
|
|
114
|
+
getVariable(name: string, opt_type?: string): IVariableModel<IVariableState> | null;
|
|
114
115
|
/**
|
|
115
116
|
* Find the variable by the given ID and return it. Return null if not found.
|
|
116
117
|
*
|
|
117
118
|
* @param id The ID to check for.
|
|
118
119
|
* @returns The variable with the given ID.
|
|
119
120
|
*/
|
|
120
|
-
getVariableById(id: string):
|
|
121
|
+
getVariableById(id: string): IVariableModel<IVariableState> | null;
|
|
121
122
|
/**
|
|
122
123
|
* Get a list containing all of the variables of a specified type. If type is
|
|
123
124
|
* null, return list of variables with empty string type.
|
|
@@ -126,33 +127,30 @@ export declare class VariableMap {
|
|
|
126
127
|
* @returns The sought after variables of the passed in type. An empty array
|
|
127
128
|
* if none are found.
|
|
128
129
|
*/
|
|
129
|
-
getVariablesOfType(type: string | null):
|
|
130
|
+
getVariablesOfType(type: string | null): IVariableModel<IVariableState>[];
|
|
130
131
|
/**
|
|
131
|
-
*
|
|
132
|
-
* contains the empty string.
|
|
132
|
+
* Returns a list of unique types of variables in this variable map.
|
|
133
133
|
*
|
|
134
|
-
* @
|
|
135
|
-
* different than the workspace stored on this object if the passed in ws
|
|
136
|
-
* is a flyout workspace.
|
|
137
|
-
* @returns List of variable types.
|
|
138
|
-
* @internal
|
|
134
|
+
* @returns A list of unique types of variables in this variable map.
|
|
139
135
|
*/
|
|
140
|
-
|
|
136
|
+
getTypes(): string[];
|
|
141
137
|
/**
|
|
142
138
|
* Return all variables of all types.
|
|
143
139
|
*
|
|
144
140
|
* @returns List of variable models.
|
|
145
141
|
*/
|
|
146
|
-
getAllVariables():
|
|
142
|
+
getAllVariables(): IVariableModel<IVariableState>[];
|
|
147
143
|
/**
|
|
148
144
|
* Returns all of the variable names of all types.
|
|
149
145
|
*
|
|
146
|
+
* @deprecated v12, use Blockly.Variables.getAllVariables.
|
|
150
147
|
* @returns All of the variable names of all types.
|
|
151
148
|
*/
|
|
152
149
|
getAllVariableNames(): string[];
|
|
153
150
|
/**
|
|
154
151
|
* Find all the uses of a named variable.
|
|
155
152
|
*
|
|
153
|
+
* @deprecated v12, use Blockly.Variables.getVariableUsesById.
|
|
156
154
|
* @param id ID of the variable to find.
|
|
157
155
|
* @returns Array of block usages.
|
|
158
156
|
*/
|