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.
Files changed (87) hide show
  1. package/blockly.min.js +737 -734
  2. package/blockly.mjs +5 -1
  3. package/blockly_compressed.js +719 -717
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +18 -17
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +22 -22
  8. package/core/block_flyout_inflater.d.ts +89 -0
  9. package/core/block_svg.d.ts +21 -10
  10. package/core/blockly.d.ts +11 -4
  11. package/core/bubbles/textinput_bubble.d.ts +9 -0
  12. package/core/button_flyout_inflater.d.ts +36 -0
  13. package/core/clipboard.d.ts +2 -2
  14. package/core/comments/comment_view.d.ts +4 -0
  15. package/core/comments/rendered_workspace_comment.d.ts +2 -0
  16. package/core/component_manager.d.ts +1 -1
  17. package/core/contextmenu_registry.d.ts +1 -1
  18. package/core/dragging/block_drag_strategy.d.ts +2 -0
  19. package/core/dropdowndiv.d.ts +1 -1
  20. package/core/events/events.d.ts +1 -0
  21. package/core/events/events_block_move.d.ts +1 -1
  22. package/core/events/events_var_base.d.ts +2 -2
  23. package/core/events/events_var_create.d.ts +7 -2
  24. package/core/events/events_var_delete.d.ts +2 -2
  25. package/core/events/events_var_rename.d.ts +2 -2
  26. package/core/events/events_var_type_change.d.ts +55 -0
  27. package/core/events/type.d.ts +2 -0
  28. package/core/field.d.ts +5 -18
  29. package/core/field_checkbox.d.ts +1 -5
  30. package/core/field_dropdown.d.ts +0 -2
  31. package/core/field_input.d.ts +5 -7
  32. package/core/field_number.d.ts +6 -0
  33. package/core/field_textinput.d.ts +1 -0
  34. package/core/field_variable.d.ts +9 -2
  35. package/core/flyout_base.d.ts +48 -177
  36. package/core/flyout_button.d.ts +25 -6
  37. package/core/flyout_horizontal.d.ts +2 -3
  38. package/core/flyout_metrics_manager.d.ts +1 -1
  39. package/core/flyout_separator.d.ts +45 -0
  40. package/core/flyout_vertical.d.ts +3 -4
  41. package/core/generator.d.ts +1 -1
  42. package/core/gesture.d.ts +1 -1
  43. package/core/grid.d.ts +4 -1
  44. package/core/icons/comment_icon.d.ts +15 -0
  45. package/core/interfaces/i_comment_icon.d.ts +3 -0
  46. package/core/interfaces/i_flyout_inflater.d.ts +39 -0
  47. package/core/interfaces/i_toolbox.d.ts +8 -1
  48. package/core/interfaces/i_variable_backed_parameter_model.d.ts +2 -2
  49. package/core/interfaces/i_variable_map.d.ts +48 -0
  50. package/core/interfaces/i_variable_model.d.ts +36 -0
  51. package/core/label_flyout_inflater.d.ts +36 -0
  52. package/core/marker_manager.d.ts +3 -3
  53. package/core/menuitem.d.ts +0 -7
  54. package/core/names.d.ts +8 -2
  55. package/core/options.d.ts +4 -4
  56. package/core/registry.d.ts +6 -0
  57. package/core/renderers/common/constants.d.ts +6 -1
  58. package/core/renderers/common/i_path_object.d.ts +13 -13
  59. package/core/renderers/common/renderer.d.ts +12 -17
  60. package/core/renderers/geras/renderer.d.ts +1 -1
  61. package/core/renderers/zelos/constants.d.ts +8 -2
  62. package/core/renderers/zelos/renderer.d.ts +0 -7
  63. package/core/scrollbar_pair.d.ts +1 -1
  64. package/core/separator_flyout_inflater.d.ts +47 -0
  65. package/core/serialization/variables.d.ts +3 -10
  66. package/core/shortcut_registry.d.ts +2 -2
  67. package/core/theme_manager.d.ts +1 -1
  68. package/core/toolbox/category.d.ts +2 -2
  69. package/core/toolbox/collapsible_category.d.ts +1 -1
  70. package/core/toolbox/separator.d.ts +1 -1
  71. package/core/toolbox/toolbox.d.ts +10 -13
  72. package/core/variable_map.d.ts +29 -31
  73. package/core/variable_model.d.ts +38 -12
  74. package/core/variables.d.ts +38 -8
  75. package/core/widgetdiv.d.ts +2 -2
  76. package/core/workspace.d.ts +22 -20
  77. package/core/workspace_audio.d.ts +1 -1
  78. package/core/workspace_dragger.d.ts +2 -2
  79. package/core/workspace_svg.d.ts +40 -13
  80. package/core/xml.d.ts +2 -2
  81. package/index.mjs +5 -1
  82. package/package.json +7 -6
  83. package/php_compressed.js +1 -1
  84. package/php_compressed.js.map +1 -1
  85. package/python_compressed.js +1 -1
  86. package/python_compressed.js.map +1 -1
  87. package/core/insertion_marker_manager.d.ts +0 -249
@@ -9,13 +9,16 @@
9
9
  * @class
10
10
  */
11
11
  import type { IASTNodeLocationSvg } from './blockly.js';
12
+ import type { IBoundedElement } from './interfaces/i_bounded_element.js';
13
+ import type { IRenderedElement } from './interfaces/i_rendered_element.js';
12
14
  import { Coordinate } from './utils/coordinate.js';
15
+ import { Rect } from './utils/rect.js';
13
16
  import type * as toolbox from './utils/toolbox.js';
14
17
  import type { WorkspaceSvg } from './workspace_svg.js';
15
18
  /**
16
19
  * Class for a button or label in the flyout.
17
20
  */
18
- export declare class FlyoutButton implements IASTNodeLocationSvg {
21
+ export declare class FlyoutButton implements IASTNodeLocationSvg, IBoundedElement, IRenderedElement {
19
22
  private readonly workspace;
20
23
  private readonly targetWorkspace;
21
24
  private readonly isFlyoutLabel;
@@ -30,6 +33,7 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
30
33
  private readonly callbackKey;
31
34
  private readonly cssClass;
32
35
  /** Mouse up event data. */
36
+ private onMouseDownWrapper;
33
37
  private onMouseUpWrapper;
34
38
  info: toolbox.ButtonOrLabelInfo;
35
39
  /** The width of the button's rect. */
@@ -53,11 +57,6 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
53
57
  * @internal
54
58
  */
55
59
  constructor(workspace: WorkspaceSvg, targetWorkspace: WorkspaceSvg, json: toolbox.ButtonOrLabelInfo, isFlyoutLabel: boolean);
56
- /**
57
- * Create the button elements.
58
- *
59
- * @returns The button's SVG group.
60
- */
61
60
  createDom(): SVGElement;
62
61
  /** Correctly position the flyout button and make it visible. */
63
62
  show(): void;
@@ -70,6 +69,14 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
70
69
  * @param y The new y coordinate.
71
70
  */
72
71
  moveTo(x: number, y: number): void;
72
+ /**
73
+ * Move the element by a relative offset.
74
+ *
75
+ * @param dx Horizontal offset in workspace units.
76
+ * @param dy Vertical offset in workspace units.
77
+ * @param _reason Why is this move happening? 'user', 'bump', 'snap'...
78
+ */
79
+ moveBy(dx: number, dy: number, _reason?: string[]): void;
73
80
  /** @returns Whether or not the button is a label. */
74
81
  isLabel(): boolean;
75
82
  /**
@@ -79,6 +86,13 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
79
86
  * @internal
80
87
  */
81
88
  getPosition(): Coordinate;
89
+ /**
90
+ * Returns the coordinates of a bounded element describing the dimensions of
91
+ * the element. Coordinate system: workspace coordinates.
92
+ *
93
+ * @returns Object with coordinates of the bounded element.
94
+ */
95
+ getBoundingRectangle(): Rect;
82
96
  /** @returns Text of the button. */
83
97
  getButtonText(): string;
84
98
  /**
@@ -114,5 +128,10 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
114
128
  * @param e Pointer up event.
115
129
  */
116
130
  private onMouseUp;
131
+ private onMouseDown;
132
+ /**
133
+ * @returns The root SVG element of this rendered element.
134
+ */
135
+ getSvgRoot(): SVGGElement;
117
136
  }
118
137
  //# sourceMappingURL=flyout_button.d.ts.map
@@ -56,10 +56,9 @@ export declare class HorizontalFlyout extends Flyout {
56
56
  /**
57
57
  * Lay out the blocks in the flyout.
58
58
  *
59
- * @param contents The blocks and buttons to lay out.
60
- * @param gaps The visible gaps between blocks.
59
+ * @param contents The flyout items to lay out.
61
60
  */
62
- protected layout_(contents: FlyoutItem[], gaps: number[]): void;
61
+ protected layout_(contents: FlyoutItem[]): void;
63
62
  /**
64
63
  * Determine if a drag delta is toward the workspace, based on the position
65
64
  * and orientation of the flyout. This is used in determineDragIntention_ to
@@ -29,7 +29,7 @@ export declare class FlyoutMetricsManager extends MetricsManager {
29
29
  *
30
30
  * @returns The bounding box of the blocks on the workspace.
31
31
  */
32
- private getBoundingBox_;
32
+ private getBoundingBox;
33
33
  getContentMetrics(opt_getWorkspaceCoordinates?: boolean): {
34
34
  height: number;
35
35
  width: number;
@@ -0,0 +1,45 @@
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 { Rect } from './utils/rect.js';
8
+ /**
9
+ * Representation of a gap between elements in a flyout.
10
+ */
11
+ export declare class FlyoutSeparator implements IBoundedElement {
12
+ private gap;
13
+ private axis;
14
+ private x;
15
+ private y;
16
+ /**
17
+ * Creates a new separator.
18
+ *
19
+ * @param gap The amount of space this separator should occupy.
20
+ * @param axis The axis along which this separator occupies space.
21
+ */
22
+ constructor(gap: number, axis: SeparatorAxis);
23
+ /**
24
+ * Returns the bounding box of this separator.
25
+ *
26
+ * @returns The bounding box of this separator.
27
+ */
28
+ getBoundingRectangle(): Rect;
29
+ /**
30
+ * Repositions this separator.
31
+ *
32
+ * @param dx The distance to move this separator on the X axis.
33
+ * @param dy The distance to move this separator on the Y axis.
34
+ * @param _reason The reason this move was initiated.
35
+ */
36
+ moveBy(dx: number, dy: number, _reason?: string[]): void;
37
+ }
38
+ /**
39
+ * Representation of an axis along which a separator occupies space.
40
+ */
41
+ export declare const enum SeparatorAxis {
42
+ X = "x",
43
+ Y = "y"
44
+ }
45
+ //# sourceMappingURL=flyout_separator.d.ts.map
@@ -57,10 +57,9 @@ export declare class VerticalFlyout extends Flyout {
57
57
  /**
58
58
  * Lay out the blocks in the flyout.
59
59
  *
60
- * @param contents The blocks and buttons to lay out.
61
- * @param gaps The visible gaps between blocks.
60
+ * @param contents The flyout items to lay out.
62
61
  */
63
- protected layout_(contents: FlyoutItem[], gaps: number[]): void;
62
+ protected layout_(contents: FlyoutItem[]): void;
64
63
  /**
65
64
  * Determine if a drag delta is toward the workspace, based on the position
66
65
  * and orientation of the flyout. This is used in determineDragIntention_ to
@@ -80,7 +79,7 @@ export declare class VerticalFlyout extends Flyout {
80
79
  */
81
80
  getClientRect(): Rect | null;
82
81
  /**
83
- * Compute width of flyout. toolbox.Position mat under each block.
82
+ * Compute width of flyout.
84
83
  * For RTL: Lay out the blocks and buttons to be right-aligned.
85
84
  */
86
85
  protected reflowInternal_(): void;
@@ -19,7 +19,7 @@ import type { Workspace } from './workspace.js';
19
19
  * @deprecated
20
20
  * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/generating-code}
21
21
  * @param block The Block instance to generate code for.
22
- * @param genearator The CodeGenerator calling the function.
22
+ * @param generator The CodeGenerator calling the function.
23
23
  * @returns A string containing the generated code (for statement blocks),
24
24
  * or a [code, precedence] tuple (for value/expression blocks), or
25
25
  * null if no code should be emitted for block.
package/core/gesture.d.ts CHANGED
@@ -101,7 +101,7 @@ export declare class Gesture {
101
101
  /** The event that most recently updated this gesture. */
102
102
  private mostRecentEvent;
103
103
  /** Boolean for whether or not this gesture is a multi-touch gesture. */
104
- private isMultiTouch_;
104
+ private multiTouch;
105
105
  /** A map of cached points used for tracking multi-touch gestures. */
106
106
  private cachedPoints;
107
107
  /**
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
  }
@@ -0,0 +1,39 @@
1
+ import type { WorkspaceSvg } from '../workspace_svg.js';
2
+ import type { IBoundedElement } from './i_bounded_element.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): IBoundedElement;
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
+ gapForElement(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
+ disposeElement(element: IBoundedElement): void;
38
+ }
39
+ //# sourceMappingURL=i_flyout_inflater.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 it's position in the list of toolbox items.
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(): VariableModel;
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,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
@@ -19,13 +19,13 @@ export declare class MarkerManager {
19
19
  /** The name of the local marker. */
20
20
  static readonly LOCAL_MARKER = "local_marker_1";
21
21
  /** The cursor. */
22
- private cursor_;
22
+ private cursor;
23
23
  /** The cursor's SVG element. */
24
- private cursorSvg_;
24
+ private cursorSvg;
25
25
  /** The map of markers for the workspace. */
26
26
  private markers;
27
27
  /** The marker's SVG element. */
28
- private markerSvg_;
28
+ private markerSvg;
29
29
  /**
30
30
  * @param workspace The workspace for the marker manager.
31
31
  * @internal
@@ -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
- import type { VariableMap } from './variable_map.js';
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: VariableMap): void;
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/options.d.ts CHANGED
@@ -87,7 +87,7 @@ export declare class Options {
87
87
  * @param hasCategories Whether the workspace has categories or not.
88
88
  * @returns Normalized move options.
89
89
  */
90
- private static parseMoveOptions_;
90
+ private static parseMoveOptions;
91
91
  /**
92
92
  * Parse the user-specified zoom options, using reasonable defaults where
93
93
  * behaviour is unspecified. See zoom documentation:
@@ -96,7 +96,7 @@ export declare class Options {
96
96
  * @param options Dictionary of options.
97
97
  * @returns Normalized zoom options.
98
98
  */
99
- private static parseZoomOptions_;
99
+ private static parseZoomOptions;
100
100
  /**
101
101
  * Parse the user-specified grid options, using reasonable defaults where
102
102
  * behaviour is unspecified. See grid documentation:
@@ -105,7 +105,7 @@ export declare class Options {
105
105
  * @param options Dictionary of options.
106
106
  * @returns Normalized grid options.
107
107
  */
108
- private static parseGridOptions_;
108
+ private static parseGridOptions;
109
109
  /**
110
110
  * Parse the user-specified theme options, using the classic theme as a
111
111
  * default. https://developers.google.com/blockly/guides/configure/web/themes
@@ -113,7 +113,7 @@ export declare class Options {
113
113
  * @param options Dictionary of options.
114
114
  * @returns A Blockly Theme.
115
115
  */
116
- private static parseThemeOptions_;
116
+ private static parseThemeOptions;
117
117
  }
118
118
  export declare namespace Options {
119
119
  interface GridOptions {
@@ -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