blockly 9.0.1 → 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 (185) hide show
  1. package/README.md +2 -2
  2. package/blockly.js +1 -1
  3. package/blockly.min.js +332 -312
  4. package/blockly_compressed.js +311 -306
  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_angle.d.ts +15 -2
  16. package/core/field_dropdown.d.ts +19 -24
  17. package/core/field_variable.d.ts +3 -3
  18. package/core/generator.d.ts +4 -4
  19. package/core/interfaces/i_parameter_model.d.ts +8 -0
  20. package/core/interfaces/i_procedure_block.d.ts +13 -0
  21. package/core/interfaces/i_procedure_map.d.ts +16 -0
  22. package/core/menu.d.ts +19 -19
  23. package/core/menuitem.d.ts +8 -8
  24. package/core/mutator.d.ts +13 -13
  25. package/core/procedures/observable_parameter_model.d.ts +11 -0
  26. package/core/procedures/observable_procedure_map.d.ts +6 -1
  27. package/core/procedures/observable_procedure_model.d.ts +7 -3
  28. package/core/procedures/update_procedures.d.ts +13 -0
  29. package/core/procedures.d.ts +4 -0
  30. package/core/rendered_connection.d.ts +1 -1
  31. package/core/renderers/common/constants.d.ts +1 -6
  32. package/core/scrollbar.d.ts +68 -39
  33. package/core/serialization/blocks.d.ts +38 -0
  34. package/core/serialization/priorities.d.ts +4 -0
  35. package/core/serialization/procedures.d.ts +78 -0
  36. package/core/serialization/variables.d.ts +33 -0
  37. package/core/serialization.d.ts +2 -1
  38. package/core/theme.d.ts +5 -5
  39. package/core/warning.d.ts +4 -4
  40. package/core/workspace.d.ts +9 -5
  41. package/core/workspace_svg.d.ts +26 -26
  42. package/core/zoom_controls.d.ts +18 -18
  43. package/core-browser.js +1 -1
  44. package/core.js +1 -1
  45. package/dart.js +1 -1
  46. package/dart_compressed.js +2 -2
  47. package/dart_compressed.js.map +1 -1
  48. package/index.js +1 -1
  49. package/javascript.js +1 -1
  50. package/javascript_compressed.js +4 -5
  51. package/javascript_compressed.js.map +1 -1
  52. package/lua.js +1 -1
  53. package/lua_compressed.js +2 -3
  54. package/lua_compressed.js.map +1 -1
  55. package/msg/ab.js +1 -1
  56. package/msg/ace.js +1 -1
  57. package/msg/af.js +1 -1
  58. package/msg/am.js +1 -1
  59. package/msg/ar.js +1 -1
  60. package/msg/ast.js +1 -1
  61. package/msg/az.js +1 -1
  62. package/msg/ba.js +1 -1
  63. package/msg/bcc.js +1 -1
  64. package/msg/be-tarask.js +1 -1
  65. package/msg/be.js +1 -1
  66. package/msg/bg.js +1 -1
  67. package/msg/bn.js +1 -1
  68. package/msg/br.js +1 -1
  69. package/msg/bs.js +1 -1
  70. package/msg/ca.js +1 -1
  71. package/msg/cdo.js +1 -1
  72. package/msg/cs.js +1 -1
  73. package/msg/da.js +1 -1
  74. package/msg/de.js +1 -1
  75. package/msg/diq.js +1 -1
  76. package/msg/dty.js +1 -1
  77. package/msg/ee.js +1 -1
  78. package/msg/el.js +1 -1
  79. package/msg/en-gb.js +1 -1
  80. package/msg/en.js +1 -1
  81. package/msg/eo.js +1 -1
  82. package/msg/es.js +1 -1
  83. package/msg/et.js +1 -1
  84. package/msg/eu.js +1 -1
  85. package/msg/fa.js +1 -1
  86. package/msg/fi.js +1 -1
  87. package/msg/fo.js +1 -1
  88. package/msg/fr.js +1 -1
  89. package/msg/frr.js +1 -1
  90. package/msg/gl.js +1 -1
  91. package/msg/gn.js +1 -1
  92. package/msg/gor.js +1 -1
  93. package/msg/ha.js +1 -1
  94. package/msg/hak.js +1 -1
  95. package/msg/he.js +1 -1
  96. package/msg/hi.js +1 -1
  97. package/msg/hr.js +1 -1
  98. package/msg/hrx.js +1 -1
  99. package/msg/hu.js +1 -1
  100. package/msg/hy.js +1 -1
  101. package/msg/ia.js +1 -1
  102. package/msg/id.js +1 -1
  103. package/msg/ig.js +1 -1
  104. package/msg/inh.js +1 -1
  105. package/msg/is.js +1 -1
  106. package/msg/it.js +1 -1
  107. package/msg/ja.js +1 -1
  108. package/msg/ka.js +1 -1
  109. package/msg/kab.js +1 -1
  110. package/msg/kbd-cyrl.js +1 -1
  111. package/msg/km.js +1 -1
  112. package/msg/kn.js +1 -1
  113. package/msg/ko.js +1 -1
  114. package/msg/ksh.js +1 -1
  115. package/msg/ku-latn.js +1 -1
  116. package/msg/ky.js +1 -1
  117. package/msg/la.js +1 -1
  118. package/msg/lb.js +1 -1
  119. package/msg/lki.js +1 -1
  120. package/msg/lo.js +1 -1
  121. package/msg/lrc.js +1 -1
  122. package/msg/lt.js +1 -1
  123. package/msg/lv.js +1 -1
  124. package/msg/mg.js +1 -1
  125. package/msg/mk.js +1 -1
  126. package/msg/ml.js +1 -1
  127. package/msg/mnw.js +1 -1
  128. package/msg/ms.js +1 -1
  129. package/msg/my.js +1 -1
  130. package/msg/mzn.js +1 -1
  131. package/msg/nb.js +1 -1
  132. package/msg/ne.js +1 -1
  133. package/msg/nl.js +1 -1
  134. package/msg/oc.js +1 -1
  135. package/msg/olo.js +1 -1
  136. package/msg/pa.js +1 -1
  137. package/msg/pl.js +1 -1
  138. package/msg/pms.js +1 -1
  139. package/msg/ps.js +1 -1
  140. package/msg/pt-br.js +1 -1
  141. package/msg/pt.js +1 -1
  142. package/msg/ro.js +1 -1
  143. package/msg/ru.js +1 -1
  144. package/msg/sc.js +1 -1
  145. package/msg/sco.js +1 -1
  146. package/msg/sd.js +1 -1
  147. package/msg/shn.js +1 -1
  148. package/msg/si.js +1 -1
  149. package/msg/sk.js +1 -1
  150. package/msg/skr-arab.js +1 -1
  151. package/msg/sl.js +1 -1
  152. package/msg/smn.js +1 -1
  153. package/msg/sq.js +1 -1
  154. package/msg/sr-latn.js +1 -1
  155. package/msg/sr.js +1 -1
  156. package/msg/sv.js +1 -1
  157. package/msg/sw.js +1 -1
  158. package/msg/ta.js +1 -1
  159. package/msg/tcy.js +1 -1
  160. package/msg/tdd.js +1 -1
  161. package/msg/te.js +1 -1
  162. package/msg/th.js +1 -1
  163. package/msg/ti.js +1 -1
  164. package/msg/tl.js +1 -1
  165. package/msg/tlh.js +1 -1
  166. package/msg/tr.js +1 -1
  167. package/msg/ug-arab.js +1 -1
  168. package/msg/uk.js +1 -1
  169. package/msg/ur.js +1 -1
  170. package/msg/uz.js +1 -1
  171. package/msg/vi.js +1 -1
  172. package/msg/xmf.js +1 -1
  173. package/msg/yo.js +1 -1
  174. package/msg/yue.js +1 -1
  175. package/msg/zgh.js +1 -1
  176. package/msg/zh-hans.js +1 -1
  177. package/msg/zh-hant.js +1 -1
  178. package/node.js +1 -1
  179. package/package.json +13 -8
  180. package/php.js +1 -1
  181. package/php_compressed.js +2 -3
  182. package/php_compressed.js.map +1 -1
  183. package/python.js +1 -1
  184. package/python_compressed.js +2 -2
  185. package/python_compressed.js.map +1 -1
@@ -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
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. */
@@ -19,8 +19,19 @@ export declare class ObservableParameterModel implements IParameterModel {
19
19
  * Unimplemented. The built-in ParameterModel does not support typing.
20
20
  * If you want your procedure blocks to have typed parameters, you need to
21
21
  * implement your own ParameterModel.
22
+ *
23
+ * @throws Throws for the ObservableParameterModel specifically because this
24
+ * method is unimplemented.
22
25
  */
23
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[];
24
35
  /**
25
36
  * Returns the unique language-neutral ID for the parameter.
26
37
  *
@@ -5,7 +5,8 @@
5
5
  */
6
6
  import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
7
7
  import type { Workspace } from '../workspace.js';
8
- export declare class ObservableProcedureMap extends Map<string, IProcedureModel> {
8
+ import { IProcedureMap } from '../interfaces/i_procedure_map.js';
9
+ export declare class ObservableProcedureMap extends Map<string, IProcedureModel> implements IProcedureMap {
9
10
  private readonly workspace;
10
11
  constructor(workspace: Workspace);
11
12
  /**
@@ -26,5 +27,9 @@ export declare class ObservableProcedureMap extends Map<string, IProcedureModel>
26
27
  * blocks can find it.
27
28
  */
28
29
  add(proc: IProcedureModel): this;
30
+ /**
31
+ * Returns all of the procedures stored in this map.
32
+ */
33
+ getProcedures(): IProcedureModel[];
29
34
  }
30
35
  //# sourceMappingURL=observable_procedure_map.d.ts.map
@@ -13,7 +13,7 @@ export declare class ObservableProcedureModel implements IProcedureModel {
13
13
  private parameters;
14
14
  private returnTypes;
15
15
  private enabled;
16
- constructor(workspace: Workspace, id?: string);
16
+ constructor(workspace: Workspace, name: string, id?: string);
17
17
  /** Sets the human-readable name of the procedure. */
18
18
  setName(name: string): this;
19
19
  /**
@@ -25,9 +25,13 @@ export declare class ObservableProcedureModel implements IProcedureModel {
25
25
  /** Removes the parameter at the given index from the parameter list. */
26
26
  deleteParameter(index: number): this;
27
27
  /**
28
- * Sets the return type(s) of the procedure.
28
+ * Sets whether the procedure has a return value (empty array) or no return
29
+ * value (null).
29
30
  *
30
- * Pass null to represent a procedure that does not return.
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.
31
35
  */
32
36
  setReturnTypes(types: string[] | null): this;
33
37
  /**
@@ -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
@@ -7,6 +7,9 @@ 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
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
  *
@@ -33,17 +33,28 @@ export declare class Scrollbar {
33
33
  * @internal
34
34
  */
35
35
  static readonly DEFAULT_SCROLLBAR_MARGIN = 0.5;
36
- private readonly pair_;
37
- private readonly margin_;
36
+ /** Whether this scrollbar is part of a pair. */
37
+ private readonly pair;
38
+ /**
39
+ * Margin around the scrollbar (between the scrollbar and the edge of the
40
+ * viewport in pixels).
41
+ */
42
+ private readonly margin;
38
43
  /** Previously recorded metrics from the workspace. */
39
- private oldHostMetrics_;
44
+ private oldHostMetrics;
40
45
  /**
41
46
  * The ratio of handle position offset to workspace content displacement.
42
47
  *
43
48
  * @internal
44
49
  */
45
50
  ratio: number;
46
- private origin_;
51
+ /**
52
+ * The location of the origin of the workspace that the scrollbar is in,
53
+ * measured in CSS pixels relative to the injection div origin. This is
54
+ * usually (0, 0). When the scrollbar is in a flyout it may have a
55
+ * different origin.
56
+ */
57
+ private origin;
47
58
  /**
48
59
  * The position of the mouse along this scrollbar's major axis at the start
49
60
  * of the most recent drag. Units are CSS pixels, with (0, 0) at the top
@@ -51,35 +62,56 @@ export declare class Scrollbar {
51
62
  * coordinate of the mouse down event; for a vertical scrollbar it's the y
52
63
  * coordinate of the mouse down event.
53
64
  */
54
- private startDragMouse_;
65
+ private startDragMouse;
55
66
  /**
56
67
  * The length of the scrollbars (including the handle and the background),
57
68
  * in CSS pixels. This is equivalent to scrollbar background length and the
58
69
  * area within which the scrollbar handle can move.
59
70
  */
60
- private scrollbarLength_;
71
+ private scrollbarLength;
61
72
  /** The length of the scrollbar handle in CSS pixels. */
62
- private handleLength_;
73
+ private handleLength;
63
74
  /**
64
75
  * The offset of the start of the handle from the scrollbar position, in CSS
65
76
  * pixels.
66
77
  */
67
- private handlePosition_;
78
+ private handlePosition;
68
79
  private startDragHandle;
69
80
  /** Whether the scrollbar handle is visible. */
70
- private isVisible_;
81
+ private isHandleVisible;
71
82
  /** Whether the workspace containing this scrollbar is visible. */
72
- private containerVisible_;
73
- private svgBackground_;
74
- private svgHandle_;
75
- private outerSvg_;
76
- private svgGroup_;
83
+ private containerVisible;
84
+ /** The transparent background behind the handle. */
85
+ private svgBackground;
86
+ /** The visible handle that can be dragged around. */
87
+ private svgHandle;
88
+ /** The outermost SVG element, which contains all parts of the scrollbar. */
89
+ private outerSvg;
90
+ /**
91
+ * The upper left corner of the scrollbar's SVG group in CSS pixels relative
92
+ * to the scrollbar's origin. This is usually relative to the injection div
93
+ * origin.
94
+ *
95
+ * @internal
96
+ */
77
97
  position: Coordinate;
98
+ /**
99
+ * The DOM attribute that controls the length of the scrollbar. Different
100
+ * for horizontal and vertical scrollbars.
101
+ */
78
102
  lengthAttribute_: string;
103
+ /**
104
+ * The DOM attribute that controls the position of the scrollbar.
105
+ * Different for horizontal and vertical scrollbars.
106
+ */
79
107
  positionAttribute_: string;
80
- onMouseDownBarWrapper_: browserEvents.Data | null;
81
- onMouseDownHandleWrapper_: browserEvents.Data | null;
108
+ /** Handler for mouse down events on the background of the scrollbar. */
109
+ onMouseDownBarWrapper_: browserEvents.Data;
110
+ /** Handler for mouse down events on the handle of the scrollbar. */
111
+ onMouseDownHandleWrapper_: browserEvents.Data;
112
+ /** Handler for mouse move events during scrollbar drags. */
82
113
  onMouseUpWrapper_: browserEvents.Data | null;
114
+ /** Handler for mouse up events to end scrollbar drags. */
83
115
  onMouseMoveWrapper_: browserEvents.Data | null;
84
116
  /**
85
117
  * @param workspace Workspace to bind the scrollbar to.
@@ -90,8 +122,12 @@ export declare class Scrollbar {
90
122
  */
91
123
  constructor(workspace: WorkspaceSvg, horizontal: boolean, opt_pair?: boolean, opt_class?: string, opt_margin?: number);
92
124
  /**
93
- * Dispose of this scrollbar.
94
- * Unlink from all DOM elements to prevent memory leaks.
125
+ * Set the size of the scrollbar DOM elements along the minor axis.
126
+ */
127
+ private setInitialThickness;
128
+ /**
129
+ * Dispose of this scrollbar. Remove DOM elements, event listeners,
130
+ * and theme subscriptions.
95
131
  *
96
132
  * @suppress {checkTypes}
97
133
  */
@@ -103,14 +139,14 @@ export declare class Scrollbar {
103
139
  * @param value Value that is potentially out of bounds, in CSS pixels.
104
140
  * @returns Constrained value, in CSS pixels.
105
141
  */
106
- private constrainHandleLength_;
142
+ private constrainHandleLength;
107
143
  /**
108
144
  * Set the length of the scrollbar's handle and change the SVG attribute
109
145
  * accordingly.
110
146
  *
111
147
  * @param newLength The new scrollbar handle length in CSS pixels.
112
148
  */
113
- private setHandleLength_;
149
+ private setHandleLength;
114
150
  /**
115
151
  * Constrain the handle's position within the minimum (0) and maximum values
116
152
  * allowed for the scrollbar.
@@ -118,7 +154,7 @@ export declare class Scrollbar {
118
154
  * @param value Value that is potentially out of bounds, in CSS pixels.
119
155
  * @returns Constrained value, in CSS pixels.
120
156
  */
121
- private constrainHandlePosition_;
157
+ private constrainHandlePosition;
122
158
  /**
123
159
  * Set the offset of the scrollbar's handle from the scrollbar's position, and
124
160
  * change the SVG attribute accordingly.
@@ -132,7 +168,7 @@ export declare class Scrollbar {
132
168
  *
133
169
  * @param newSize The new scrollbar background length in CSS pixels.
134
170
  */
135
- private setScrollbarLength_;
171
+ private setScrollbarLength;
136
172
  /**
137
173
  * Set the position of the scrollbar's SVG group in CSS pixels relative to the
138
174
  * scrollbar's origin. This sets the scrollbar's location within the
@@ -158,14 +194,14 @@ export declare class Scrollbar {
158
194
  * possibly fetched from the host object.
159
195
  * @returns Whether a resizeView is necessary.
160
196
  */
161
- private requiresViewResize_;
197
+ private requiresViewResize;
162
198
  /**
163
199
  * Recalculate a horizontal scrollbar's location and length.
164
200
  *
165
201
  * @param hostMetrics A data structure describing all the required dimensions,
166
202
  * possibly fetched from the host object.
167
203
  */
168
- private resizeHorizontal_;
204
+ private resizeHorizontal;
169
205
  /**
170
206
  * Recalculate a horizontal scrollbar's location on the screen and path
171
207
  * length. This should be called when the layout or size of the window has
@@ -189,7 +225,7 @@ export declare class Scrollbar {
189
225
  * @param hostMetrics A data structure describing all the required dimensions,
190
226
  * possibly fetched from the host object.
191
227
  */
192
- private resizeVertical_;
228
+ private resizeVertical;
193
229
  /**
194
230
  * Recalculate a vertical scrollbar's location on the screen and path length.
195
231
  * This should be called when the layout or size of the window has changed.
@@ -206,13 +242,6 @@ export declare class Scrollbar {
206
242
  * possibly fetched from the host object.
207
243
  */
208
244
  resizeContentVertical(hostMetrics: Metrics): void;
209
- /**
210
- * Create all the DOM elements required for a scrollbar.
211
- * The resulting widget is not sized.
212
- *
213
- * @param opt_class A class to be applied to this scrollbar.
214
- */
215
- private createDom_;
216
245
  /**
217
246
  * Is the scrollbar visible. Non-paired scrollbars disappear when they aren't
218
247
  * needed.
@@ -247,27 +276,27 @@ export declare class Scrollbar {
247
276
  *
248
277
  * @param e Mouse down event.
249
278
  */
250
- private onMouseDownBar_;
279
+ private onMouseDownBar;
251
280
  /**
252
281
  * Start a dragging operation.
253
282
  * Called when scrollbar handle is clicked.
254
283
  *
255
284
  * @param e Mouse down event.
256
285
  */
257
- private onMouseDownHandle_;
286
+ private onMouseDownHandle;
258
287
  /**
259
288
  * Drag the scrollbar's handle.
260
289
  *
261
290
  * @param e Mouse move event.
262
291
  */
263
- private onMouseMoveHandle_;
292
+ private onMouseMoveHandle;
264
293
  /** Release the scrollbar handle and reset state accordingly. */
265
- private onMouseUpHandle_;
294
+ private onMouseUpHandle;
266
295
  /**
267
296
  * Hide chaff and stop binding to mouseup and mousemove events. Call this to
268
297
  * wrap up loose ends associated with the scrollbar.
269
298
  */
270
- private cleanUp_;
299
+ private cleanUp;
271
300
  /**
272
301
  * Helper to calculate the ratio of handle position to scrollbar view size.
273
302
  *
@@ -279,7 +308,7 @@ export declare class Scrollbar {
279
308
  * Updates workspace metrics based on new scroll ratio. Called when scrollbar
280
309
  * is moved.
281
310
  */
282
- private updateMetrics_;
311
+ private updateMetrics;
283
312
  /**
284
313
  * Set the scrollbar handle's position.
285
314
  *
@@ -304,6 +333,6 @@ export declare class Scrollbar {
304
333
  * workspace.
305
334
  * @returns Whether the two sets of metrics are equivalent.
306
335
  */
307
- private static metricsAreEquivalent_;
336
+ private static metricsAreEquivalent;
308
337
  }
309
338
  //# sourceMappingURL=scrollbar.d.ts.map
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { Block } from '../block.js';
7
7
  import type { Connection } from '../connection.js';
8
+ import type { ISerializer } from '../interfaces/i_serializer.js';
8
9
  import type { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Represents the state of a connection.
@@ -101,4 +102,41 @@ export declare function appendInternal(state: State, workspace: Workspace, { par
101
102
  isShadow?: boolean;
102
103
  recordUndo?: boolean;
103
104
  }): Block;
105
+ /**
106
+ * Serializer for saving and loading block state.
107
+ *
108
+ * @alias Blockly.serialization.blocks.BlockSerializer
109
+ */
110
+ export declare class BlockSerializer implements ISerializer {
111
+ priority: number;
112
+ constructor();
113
+ /**
114
+ * Serializes the blocks of the given workspace.
115
+ *
116
+ * @param workspace The workspace to save the blocks of.
117
+ * @returns The state of the workspace's blocks, or null if there are no
118
+ * blocks.
119
+ */
120
+ save(workspace: Workspace): {
121
+ languageVersion: number;
122
+ blocks: State[];
123
+ } | null;
124
+ /**
125
+ * Deserializes the blocks defined by the given state into the given
126
+ * workspace.
127
+ *
128
+ * @param state The state of the blocks to deserialize.
129
+ * @param workspace The workspace to deserialize into.
130
+ */
131
+ load(state: {
132
+ languageVersion: number;
133
+ blocks: State[];
134
+ }, workspace: Workspace): void;
135
+ /**
136
+ * Disposes of any blocks that exist on the workspace.
137
+ *
138
+ * @param workspace The workspace to clear the blocks of.
139
+ */
140
+ clear(workspace: Workspace): void;
141
+ }
104
142
  //# sourceMappingURL=blocks.d.ts.map
@@ -9,6 +9,10 @@
9
9
  * @alias Blockly.serialization.priorities.VARIABLES
10
10
  */
11
11
  export declare const VARIABLES = 100;
12
+ /**
13
+ * The priority for deserializing variable data.
14
+ */
15
+ export declare const PROCEDURES = 75;
12
16
  /**
13
17
  * The priority for deserializing blocks.
14
18
  *