blockly 9.0.0 → 9.1.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 (189) hide show
  1. package/README.md +2 -2
  2. package/blockly.js +1 -1
  3. package/blockly.min.js +397 -374
  4. package/blockly_compressed.js +376 -368
  5. package/blockly_compressed.js.map +1 -1
  6. package/blocks.js +1 -1
  7. package/blocks_compressed.js +1 -1
  8. package/blocks_compressed.js.map +1 -1
  9. package/browser.js +1 -1
  10. package/core/block_drag_surface.d.ts +15 -8
  11. package/core/block_svg.d.ts +10 -4
  12. package/core/blockly.d.ts +8 -20
  13. package/core/bubble.d.ts +32 -32
  14. package/core/comment.d.ts +15 -19
  15. package/core/field.d.ts +10 -1
  16. package/core/field_angle.d.ts +15 -2
  17. package/core/field_dropdown.d.ts +19 -24
  18. package/core/field_variable.d.ts +3 -3
  19. package/core/generator.d.ts +4 -4
  20. package/core/interfaces/i_ast_node_location_with_block.d.ts +1 -1
  21. package/core/interfaces/i_parameter_model.d.ts +39 -0
  22. package/core/interfaces/i_procedure_block.d.ts +13 -0
  23. package/core/interfaces/i_procedure_map.d.ts +16 -0
  24. package/core/interfaces/i_procedure_model.d.ts +57 -0
  25. package/core/menu.d.ts +19 -19
  26. package/core/menuitem.d.ts +8 -8
  27. package/core/mutator.d.ts +13 -13
  28. package/core/procedures/observable_parameter_model.d.ts +45 -0
  29. package/core/procedures/observable_procedure_map.d.ts +35 -0
  30. package/core/procedures/observable_procedure_model.d.ts +62 -0
  31. package/core/procedures/update_procedures.d.ts +13 -0
  32. package/core/procedures.d.ts +5 -1
  33. package/core/rendered_connection.d.ts +1 -1
  34. package/core/renderers/common/constants.d.ts +1 -6
  35. package/core/scrollbar.d.ts +68 -39
  36. package/core/serialization/blocks.d.ts +38 -0
  37. package/core/serialization/priorities.d.ts +4 -0
  38. package/core/serialization/procedures.d.ts +78 -0
  39. package/core/serialization/variables.d.ts +33 -0
  40. package/core/serialization.d.ts +15 -0
  41. package/core/theme.d.ts +5 -5
  42. package/core/touch.d.ts +3 -3
  43. package/core/warning.d.ts +4 -4
  44. package/core/workspace.d.ts +9 -5
  45. package/core/workspace_svg.d.ts +26 -26
  46. package/core/zoom_controls.d.ts +18 -18
  47. package/core-browser.js +1 -1
  48. package/core.js +1 -1
  49. package/dart.js +1 -1
  50. package/dart_compressed.js +2 -2
  51. package/dart_compressed.js.map +1 -1
  52. package/index.js +1 -1
  53. package/javascript.js +1 -1
  54. package/javascript_compressed.js +4 -5
  55. package/javascript_compressed.js.map +1 -1
  56. package/lua.js +1 -1
  57. package/lua_compressed.js +2 -3
  58. package/lua_compressed.js.map +1 -1
  59. package/msg/ab.js +1 -1
  60. package/msg/ace.js +1 -1
  61. package/msg/af.js +1 -1
  62. package/msg/am.js +1 -1
  63. package/msg/ar.js +1 -1
  64. package/msg/ast.js +1 -1
  65. package/msg/az.js +1 -1
  66. package/msg/ba.js +1 -1
  67. package/msg/bcc.js +1 -1
  68. package/msg/be-tarask.js +1 -1
  69. package/msg/be.js +1 -1
  70. package/msg/bg.js +1 -1
  71. package/msg/bn.js +1 -1
  72. package/msg/br.js +1 -1
  73. package/msg/bs.js +1 -1
  74. package/msg/ca.js +1 -1
  75. package/msg/cdo.js +1 -1
  76. package/msg/cs.js +1 -1
  77. package/msg/da.js +1 -1
  78. package/msg/de.js +1 -1
  79. package/msg/diq.js +1 -1
  80. package/msg/dty.js +1 -1
  81. package/msg/ee.js +1 -1
  82. package/msg/el.js +1 -1
  83. package/msg/en-gb.js +1 -1
  84. package/msg/en.js +1 -1
  85. package/msg/eo.js +1 -1
  86. package/msg/es.js +1 -1
  87. package/msg/et.js +1 -1
  88. package/msg/eu.js +1 -1
  89. package/msg/fa.js +1 -1
  90. package/msg/fi.js +1 -1
  91. package/msg/fo.js +1 -1
  92. package/msg/fr.js +1 -1
  93. package/msg/frr.js +1 -1
  94. package/msg/gl.js +1 -1
  95. package/msg/gn.js +1 -1
  96. package/msg/gor.js +1 -1
  97. package/msg/ha.js +1 -1
  98. package/msg/hak.js +1 -1
  99. package/msg/he.js +1 -1
  100. package/msg/hi.js +1 -1
  101. package/msg/hr.js +1 -1
  102. package/msg/hrx.js +1 -1
  103. package/msg/hu.js +1 -1
  104. package/msg/hy.js +1 -1
  105. package/msg/ia.js +1 -1
  106. package/msg/id.js +1 -1
  107. package/msg/ig.js +1 -1
  108. package/msg/inh.js +1 -1
  109. package/msg/is.js +1 -1
  110. package/msg/it.js +1 -1
  111. package/msg/ja.js +1 -1
  112. package/msg/ka.js +1 -1
  113. package/msg/kab.js +1 -1
  114. package/msg/kbd-cyrl.js +1 -1
  115. package/msg/km.js +1 -1
  116. package/msg/kn.js +1 -1
  117. package/msg/ko.js +1 -1
  118. package/msg/ksh.js +1 -1
  119. package/msg/ku-latn.js +1 -1
  120. package/msg/ky.js +1 -1
  121. package/msg/la.js +1 -1
  122. package/msg/lb.js +1 -1
  123. package/msg/lki.js +1 -1
  124. package/msg/lo.js +1 -1
  125. package/msg/lrc.js +1 -1
  126. package/msg/lt.js +1 -1
  127. package/msg/lv.js +1 -1
  128. package/msg/mg.js +1 -1
  129. package/msg/mk.js +1 -1
  130. package/msg/ml.js +1 -1
  131. package/msg/mnw.js +1 -1
  132. package/msg/ms.js +1 -1
  133. package/msg/my.js +1 -1
  134. package/msg/mzn.js +1 -1
  135. package/msg/nb.js +1 -1
  136. package/msg/ne.js +1 -1
  137. package/msg/nl.js +1 -1
  138. package/msg/oc.js +1 -1
  139. package/msg/olo.js +1 -1
  140. package/msg/pa.js +1 -1
  141. package/msg/pl.js +1 -1
  142. package/msg/pms.js +1 -1
  143. package/msg/ps.js +1 -1
  144. package/msg/pt-br.js +1 -1
  145. package/msg/pt.js +1 -1
  146. package/msg/ro.js +1 -1
  147. package/msg/ru.js +1 -1
  148. package/msg/sc.js +1 -1
  149. package/msg/sco.js +1 -1
  150. package/msg/sd.js +1 -1
  151. package/msg/shn.js +1 -1
  152. package/msg/si.js +1 -1
  153. package/msg/sk.js +1 -1
  154. package/msg/skr-arab.js +1 -1
  155. package/msg/sl.js +1 -1
  156. package/msg/smn.js +1 -1
  157. package/msg/sq.js +1 -1
  158. package/msg/sr-latn.js +1 -1
  159. package/msg/sr.js +1 -1
  160. package/msg/sv.js +1 -1
  161. package/msg/sw.js +1 -1
  162. package/msg/ta.js +1 -1
  163. package/msg/tcy.js +1 -1
  164. package/msg/tdd.js +1 -1
  165. package/msg/te.js +1 -1
  166. package/msg/th.js +1 -1
  167. package/msg/ti.js +1 -1
  168. package/msg/tl.js +1 -1
  169. package/msg/tlh.js +1 -1
  170. package/msg/tr.js +1 -1
  171. package/msg/ug-arab.js +1 -1
  172. package/msg/uk.js +1 -1
  173. package/msg/ur.js +1 -1
  174. package/msg/uz.js +1 -1
  175. package/msg/vi.js +1 -1
  176. package/msg/xmf.js +1 -1
  177. package/msg/yo.js +1 -1
  178. package/msg/yue.js +1 -1
  179. package/msg/zgh.js +1 -1
  180. package/msg/zh-hans.js +1 -1
  181. package/msg/zh-hant.js +1 -1
  182. package/node.js +1 -1
  183. package/package.json +13 -8
  184. package/php.js +1 -1
  185. package/php_compressed.js +2 -3
  186. package/php_compressed.js.map +1 -1
  187. package/python.js +1 -1
  188. package/python_compressed.js +2 -2
  189. package/python_compressed.js.map +1 -1
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The interface for the data model of a procedure parameter.
8
+ *
9
+ * @namespace Blockly.IParameterModel
10
+ */
11
+ /**
12
+ * A data model for a procedure.
13
+ */
14
+ export interface IParameterModel {
15
+ /**
16
+ * Sets the name of this parameter to the given name.
17
+ */
18
+ setName(name: string): this;
19
+ /**
20
+ * Sets the types of this parameter to the given type.
21
+ */
22
+ setTypes(types: string[]): this;
23
+ /**
24
+ * Returns the name of this parameter.
25
+ */
26
+ getName(): string;
27
+ /**
28
+ * Return the types of this parameter.
29
+ */
30
+ getTypes(): string[];
31
+ /**
32
+ * Returns the unique language-neutral ID for the parameter.
33
+ *
34
+ * This represents the identify of the variable model which does not change
35
+ * over time.
36
+ */
37
+ getId(): string;
38
+ }
39
+ //# sourceMappingURL=i_parameter_model.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ /** The interface for a block which models a procedure. */
8
+ export interface IProcedureBlock {
9
+ doProcedureUpdate(): void;
10
+ }
11
+ /** A type guard which checks if the given block is a procedure block. */
12
+ export declare function isProcedureBlock(block: Block | IProcedureBlock): block is IProcedureBlock;
13
+ //# sourceMappingURL=i_procedure_block.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { IProcedureModel } from './i_procedure_model.js';
7
+ export interface IProcedureMap extends Map<string, IProcedureModel> {
8
+ /**
9
+ * Adds the given ProcedureModel to the map of procedure models, so that
10
+ * blocks can find it.
11
+ */
12
+ add(proc: IProcedureModel): this;
13
+ /** Returns all of the procedures stored in this map. */
14
+ getProcedures(): IProcedureModel[];
15
+ }
16
+ //# sourceMappingURL=i_procedure_map.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The interface for the data model of a procedure.
8
+ *
9
+ * @namespace Blockly.IProcedureModel
10
+ */
11
+ import { IParameterModel } from './i_parameter_model.js';
12
+ /**
13
+ * A data model for a procedure.
14
+ */
15
+ export interface IProcedureModel {
16
+ /** Sets the human-readable name of the procedure. */
17
+ setName(name: string): this;
18
+ /**
19
+ * Inserts a parameter into the list of parameters.
20
+ *
21
+ * To move a parameter, first delete it, and then re-insert.
22
+ */
23
+ insertParameter(parameterModel: IParameterModel, index: number): this;
24
+ /** Removes the parameter at the given index from the parameter list. */
25
+ deleteParameter(index: number): this;
26
+ /**
27
+ * Sets the return type(s) of the procedure.
28
+ *
29
+ * Pass null to represent a procedure that does not return.
30
+ */
31
+ setReturnTypes(types: string[] | null): this;
32
+ /**
33
+ * Sets whether this procedure is enabled/disabled. If a procedure is disabled
34
+ * all procedure caller blocks should be disabled as well.
35
+ */
36
+ setEnabled(enabled: boolean): this;
37
+ /** Returns the unique language-neutral ID for the procedure. */
38
+ getId(): string;
39
+ /** Returns the human-readable name of the procedure. */
40
+ getName(): string;
41
+ /** Returns the parameter at the given index in the parameter list. */
42
+ getParameter(index: number): IParameterModel;
43
+ /** Returns an array of all of the parameters in the parameter list. */
44
+ getParameters(): IParameterModel[];
45
+ /**
46
+ * Returns the return type(s) of the procedure.
47
+ *
48
+ * Null represents a procedure that does not return a value.
49
+ */
50
+ getReturnTypes(): string[] | null;
51
+ /**
52
+ * Returns whether the procedure is enabled/disabled. If a procedure is
53
+ * disabled, all procedure caller blocks should be disabled as well.
54
+ */
55
+ getEnabled(): boolean;
56
+ }
57
+ //# sourceMappingURL=i_procedure_model.d.ts.map
package/core/menu.d.ts CHANGED
@@ -18,7 +18,7 @@ export declare class Menu {
18
18
  * (Nulls are never in the array, but typing the array as nullable prevents
19
19
  * the compiler from objecting to .indexOf(null))
20
20
  */
21
- private readonly menuItems_;
21
+ private readonly menuItems;
22
22
  /**
23
23
  * Coordinates of the mousedown event that caused this menu to open. Used to
24
24
  * prevent the consequent mouseup event due to a simple click from
@@ -29,21 +29,21 @@ export declare class Menu {
29
29
  * This is the element that we will listen to the real focus events on.
30
30
  * A value of null means no menu item is highlighted.
31
31
  */
32
- private highlightedItem_;
32
+ private highlightedItem;
33
33
  /** Mouse over event data. */
34
- private mouseOverHandler_;
34
+ private mouseOverHandler;
35
35
  /** Click event data. */
36
- private clickHandler_;
36
+ private clickHandler;
37
37
  /** Mouse enter event data. */
38
- private mouseEnterHandler_;
38
+ private mouseEnterHandler;
39
39
  /** Mouse leave event data. */
40
- private mouseLeaveHandler_;
40
+ private mouseLeaveHandler;
41
41
  /** Key down event data. */
42
- private onKeyDownHandler_;
42
+ private onKeyDownHandler;
43
43
  /** The menu's root DOM element. */
44
- private element_;
44
+ private element;
45
45
  /** ARIA name for this menu. */
46
- private roleName_;
46
+ private roleName;
47
47
  /** Constructs a new Menu instance. */
48
48
  constructor();
49
49
  /**
@@ -74,7 +74,7 @@ export declare class Menu {
74
74
  */
75
75
  focus(): void;
76
76
  /** Blur the menu element. */
77
- private blur_;
77
+ private blur;
78
78
  /**
79
79
  * Set the menu accessibility role.
80
80
  *
@@ -91,7 +91,7 @@ export declare class Menu {
91
91
  * @param elem DOM element whose owner is to be returned.
92
92
  * @returns Menu item for which the DOM element belongs to.
93
93
  */
94
- private getMenuItem_;
94
+ private getMenuItem;
95
95
  /**
96
96
  * Highlights the given menu item, or clears highlighting if null.
97
97
  *
@@ -114,9 +114,9 @@ export declare class Menu {
114
114
  */
115
115
  highlightPrevious(): void;
116
116
  /** Highlights the first highlightable item. */
117
- private highlightFirst_;
117
+ private highlightFirst;
118
118
  /** Highlights the last highlightable item. */
119
- private highlightLast_;
119
+ private highlightLast;
120
120
  /**
121
121
  * Helper function that manages the details of moving the highlight among
122
122
  * child menuitems in response to keyboard events.
@@ -124,31 +124,31 @@ export declare class Menu {
124
124
  * @param startIndex Start index.
125
125
  * @param delta Step direction: 1 to go down, -1 to go up.
126
126
  */
127
- private highlightHelper_;
127
+ private highlightHelper;
128
128
  /**
129
129
  * Handles mouseover events. Highlight menuitems as the user hovers over them.
130
130
  *
131
131
  * @param e Mouse event to handle.
132
132
  */
133
- private handleMouseOver_;
133
+ private handleMouseOver;
134
134
  /**
135
135
  * Handles click events. Pass the event onto the child menuitem to handle.
136
136
  *
137
137
  * @param e Click event to handle.
138
138
  */
139
- private handleClick_;
139
+ private handleClick;
140
140
  /**
141
141
  * Handles mouse enter events. Focus the element.
142
142
  *
143
143
  * @param _e Mouse event to handle.
144
144
  */
145
- private handleMouseEnter_;
145
+ private handleMouseEnter;
146
146
  /**
147
147
  * Handles mouse leave events. Blur and clear highlight.
148
148
  *
149
149
  * @param _e Mouse event to handle.
150
150
  */
151
- private handleMouseLeave_;
151
+ private handleMouseLeave;
152
152
  /**
153
153
  * Attempts to handle a keyboard event, if the menu item is enabled, by
154
154
  * calling
@@ -156,7 +156,7 @@ export declare class Menu {
156
156
  *
157
157
  * @param e Key event to handle.
158
158
  */
159
- private handleKeyEvent_;
159
+ private handleKeyEvent;
160
160
  /**
161
161
  * Get the size of a rendered menu.
162
162
  *
@@ -13,21 +13,21 @@ export declare class MenuItem {
13
13
  private readonly content;
14
14
  private readonly opt_value?;
15
15
  /** Is the menu item clickable, as opposed to greyed-out. */
16
- private enabled_;
16
+ private enabled;
17
17
  /** The DOM element for the menu item. */
18
- private element_;
18
+ private element;
19
19
  /** Whether the menu item is rendered right-to-left. */
20
- private rightToLeft_;
20
+ private rightToLeft;
21
21
  /** ARIA name for this menu. */
22
- private roleName_;
22
+ private roleName;
23
23
  /** Is this menu item checkable. */
24
- private checkable_;
24
+ private checkable;
25
25
  /** Is this menu item currently checked. */
26
- private checked_;
26
+ private checked;
27
27
  /** Is this menu item currently highlighted. */
28
- private highlight_;
28
+ private highlight;
29
29
  /** Bound function to call when this menu item is clicked. */
30
- private actionHandler_;
30
+ private actionHandler;
31
31
  /**
32
32
  * @param content Text caption to display as the content of the item, or a
33
33
  * HTML element to display.
package/core/mutator.d.ts CHANGED
@@ -17,33 +17,33 @@ import type { WorkspaceSvg } from './workspace_svg.js';
17
17
  * @alias Blockly.Mutator
18
18
  */
19
19
  export declare class Mutator extends Icon {
20
- private quarkNames_;
20
+ private quarkNames;
21
21
  /** Workspace in the mutator's bubble. */
22
- private workspace_;
22
+ private workspace;
23
23
  /** Width of workspace. */
24
- private workspaceWidth_;
24
+ private workspaceWidth;
25
25
  /** Height of workspace. */
26
- private workspaceHeight_;
26
+ private workspaceHeight;
27
27
  /**
28
28
  * The SVG element that is the parent of the mutator workspace, or null if
29
29
  * not created.
30
30
  */
31
- private svgDialog_;
31
+ private svgDialog;
32
32
  /**
33
33
  * The root block of the mutator workspace, created by decomposing the
34
34
  * source block.
35
35
  */
36
- private rootBlock_;
36
+ private rootBlock;
37
37
  /**
38
38
  * Function registered on the main workspace to update the mutator contents
39
39
  * when the main workspace changes.
40
40
  */
41
- private sourceListener_;
41
+ private sourceListener;
42
42
  /**
43
43
  * The PID associated with the updateWorkpace_ timeout, or null if no timeout
44
44
  * is currently running.
45
45
  */
46
- private updateWorkspacePid_;
46
+ private updateWorkspacePid;
47
47
  /** @param quarkNames List of names of sub-blocks for flyout. */
48
48
  constructor(quarkNames: string[], block?: BlockSvg);
49
49
  /**
@@ -79,7 +79,7 @@ export declare class Mutator extends Icon {
79
79
  *
80
80
  * @returns The top-level node of the editor.
81
81
  */
82
- private createEditor_;
82
+ private createEditor;
83
83
  /**
84
84
  * @internal
85
85
  */
@@ -87,9 +87,9 @@ export declare class Mutator extends Icon {
87
87
  /** Add or remove the UI indicating if this icon may be clicked or not. */
88
88
  updateEditable(): void;
89
89
  /** Resize the bubble to match the size of the workspace. */
90
- private resizeBubble_;
90
+ private resizeBubble;
91
91
  /** A method handler for when the bubble is moved. */
92
- private onBubbleMove_;
92
+ private onBubbleMove;
93
93
  /**
94
94
  * Show or hide the mutator bubble.
95
95
  *
@@ -101,7 +101,7 @@ export declare class Mutator extends Icon {
101
101
  *
102
102
  * @param e Custom data for event.
103
103
  */
104
- private workspaceChanged_;
104
+ private workspaceChanged;
105
105
  /**
106
106
  * Returns whether the given event in the mutator workspace should be ignored
107
107
  * when deciding whether to update the workspace and compose the block or not.
@@ -114,7 +114,7 @@ export declare class Mutator extends Icon {
114
114
  * Updates the source block when the mutator's blocks are changed.
115
115
  * Bump down any block that's too high.
116
116
  */
117
- private updateWorkspace_;
117
+ private updateWorkspace;
118
118
  /** Dispose of this mutator. */
119
119
  dispose(): void;
120
120
  /** Update the styles on all blocks in the mutator. */
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
+ import type { VariableModel } from '../variable_model.js';
8
+ import type { Workspace } from '../workspace.js';
9
+ export declare class ObservableParameterModel implements IParameterModel {
10
+ private readonly workspace;
11
+ private id;
12
+ private variable;
13
+ constructor(workspace: Workspace, name: string, id?: string);
14
+ /**
15
+ * Sets the name of this parameter to the given name.
16
+ */
17
+ setName(name: string): this;
18
+ /**
19
+ * Unimplemented. The built-in ParameterModel does not support typing.
20
+ * If you want your procedure blocks to have typed parameters, you need to
21
+ * implement your own ParameterModel.
22
+ *
23
+ * @throws Throws for the ObservableParameterModel specifically because this
24
+ * method is unimplemented.
25
+ */
26
+ setTypes(_types: string[]): this;
27
+ /**
28
+ * Returns the name of this parameter.
29
+ */
30
+ getName(): string;
31
+ /**
32
+ * Returns the types of this parameter.
33
+ */
34
+ getTypes(): string[];
35
+ /**
36
+ * Returns the unique language-neutral ID for the parameter.
37
+ *
38
+ * This represents the identify of the variable model which does not change
39
+ * over time.
40
+ */
41
+ getId(): string;
42
+ /** Returns the variable model associated with the parameter model. */
43
+ getVariableModel(): VariableModel;
44
+ }
45
+ //# sourceMappingURL=observable_parameter_model.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
7
+ import type { Workspace } from '../workspace.js';
8
+ import { IProcedureMap } from '../interfaces/i_procedure_map.js';
9
+ export declare class ObservableProcedureMap extends Map<string, IProcedureModel> implements IProcedureMap {
10
+ private readonly workspace;
11
+ constructor(workspace: Workspace);
12
+ /**
13
+ * Adds the given procedure model to the procedure map.
14
+ */
15
+ set(id: string, proc: IProcedureModel): this;
16
+ /**
17
+ * Deletes the ProcedureModel with the given ID from the procedure map (if it
18
+ * exists).
19
+ */
20
+ delete(id: string): boolean;
21
+ /**
22
+ * Removes all ProcedureModels from the procedure map.
23
+ */
24
+ clear(): void;
25
+ /**
26
+ * Adds the given ProcedureModel to the map of procedure models, so that
27
+ * blocks can find it.
28
+ */
29
+ add(proc: IProcedureModel): this;
30
+ /**
31
+ * Returns all of the procedures stored in this map.
32
+ */
33
+ getProcedures(): IProcedureModel[];
34
+ }
35
+ //# sourceMappingURL=observable_procedure_map.d.ts.map
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
+ import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
+ import type { Workspace } from '../workspace.js';
9
+ export declare class ObservableProcedureModel implements IProcedureModel {
10
+ private readonly workspace;
11
+ private id;
12
+ private name;
13
+ private parameters;
14
+ private returnTypes;
15
+ private enabled;
16
+ constructor(workspace: Workspace, name: string, id?: string);
17
+ /** Sets the human-readable name of the procedure. */
18
+ setName(name: string): this;
19
+ /**
20
+ * Inserts a parameter into the list of parameters.
21
+ *
22
+ * To move a parameter, first delete it, and then re-insert.
23
+ */
24
+ insertParameter(parameterModel: IParameterModel, index: number): this;
25
+ /** Removes the parameter at the given index from the parameter list. */
26
+ deleteParameter(index: number): this;
27
+ /**
28
+ * Sets whether the procedure has a return value (empty array) or no return
29
+ * value (null).
30
+ *
31
+ * The built-in procedure model does not support procedures that have actual
32
+ * return types (i.e. non-empty arrays, e.g. ['number']). If you want your
33
+ * procedure block to have return types, you need to implement your own
34
+ * procedure model.
35
+ */
36
+ setReturnTypes(types: string[] | null): this;
37
+ /**
38
+ * Sets whether this procedure is enabled/disabled. If a procedure is disabled
39
+ * all procedure caller blocks should be disabled as well.
40
+ */
41
+ setEnabled(enabled: boolean): this;
42
+ /** Returns the unique language-neutral ID for the procedure. */
43
+ getId(): string;
44
+ /** Returns the human-readable name of the procedure. */
45
+ getName(): string;
46
+ /** Returns the parameter at the given index in the parameter list. */
47
+ getParameter(index: number): IParameterModel;
48
+ /** Returns an array of all of the parameters in the parameter list. */
49
+ getParameters(): IParameterModel[];
50
+ /**
51
+ * Returns the return type of the procedure.
52
+ *
53
+ * Null represents a procedure that does not return a value.
54
+ */
55
+ getReturnTypes(): string[] | null;
56
+ /**
57
+ * Returns whether the procedure is enabled/disabled. If a procedure is
58
+ * disabled, all procedure caller blocks should be disabled as well.
59
+ */
60
+ getEnabled(): boolean;
61
+ }
62
+ //# sourceMappingURL=observable_procedure_model.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Workspace } from '../workspace.js';
7
+ /**
8
+ * Calls the `doProcedureUpdate` method on all blocks which implement it.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function triggerProceduresUpdate(workspace: Workspace): void;
13
+ //# sourceMappingURL=update_procedures.d.ts.map
@@ -6,7 +6,10 @@
6
6
  import './events/events_block_change.js';
7
7
  import type { Block } from './block.js';
8
8
  import type { Abstract } from './events/events_abstract.js';
9
- import type { Field } from './field.js';
9
+ import { Field } from './field.js';
10
+ import { ObservableProcedureMap } from './procedures/observable_procedure_map.js';
11
+ import { ObservableProcedureModel } from './procedures/observable_procedure_model.js';
12
+ import { ObservableParameterModel } from './procedures/observable_parameter_model.js';
10
13
  import type { Workspace } from './workspace.js';
11
14
  import type { WorkspaceSvg } from './workspace_svg.js';
12
15
  /**
@@ -122,4 +125,5 @@ export declare function mutateCallers(defBlock: Block): void;
122
125
  * @alias Blockly.Procedures.getDefinition
123
126
  */
124
127
  export declare function getDefinition(name: string, workspace: Workspace): Block | null;
128
+ export { ObservableProcedureMap, ObservableProcedureModel, ObservableParameterModel, };
125
129
  //# sourceMappingURL=procedures.d.ts.map
@@ -177,7 +177,7 @@ export declare class RenderedConnection extends Connection {
177
177
  * @returns List of connections.
178
178
  * @internal
179
179
  */
180
- neighbours(maxLimit: number): Connection[];
180
+ neighbours(maxLimit: number): RenderedConnection[];
181
181
  /**
182
182
  * Connect two connections together. This is the connection on the superior
183
183
  * block. Rerender blocks as needed.
@@ -393,12 +393,7 @@ export declare class ConstantProvider {
393
393
  * @param blockStyle A full or partial block style object.
394
394
  * @returns A full block style object, with all required properties populated.
395
395
  */
396
- protected validatedBlockStyle_(blockStyle: {
397
- colourPrimary: string;
398
- colourSecondary?: string;
399
- colourTertiary?: string;
400
- hat?: string;
401
- }): BlockStyle;
396
+ protected validatedBlockStyle_(blockStyle: Partial<BlockStyle>): BlockStyle;
402
397
  /**
403
398
  * Generate a secondary colour from the passed in primary colour.
404
399
  *