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
@@ -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
  *
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { IParameterModel } from '../interfaces/i_parameter_model.js';
7
+ import { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
+ import type { ISerializer } from '../interfaces/i_serializer.js';
9
+ import { ObservableProcedureModel } from '../procedures/observable_procedure_model.js';
10
+ import { ObservableParameterModel } from '../procedures/observable_parameter_model.js';
11
+ import type { Workspace } from '../workspace.js';
12
+ /**
13
+ * Representation of a procedure data model.
14
+ */
15
+ export interface State {
16
+ id: string;
17
+ name: string;
18
+ returnTypes: string[] | null;
19
+ parameters?: ParameterState[];
20
+ }
21
+ /**
22
+ * Representation of a parameter data model.
23
+ */
24
+ export interface ParameterState {
25
+ id: string;
26
+ name: string;
27
+ types?: string[];
28
+ }
29
+ /**
30
+ * A newable signature for an IProcedureModel.
31
+ *
32
+ * Refer to
33
+ * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
34
+ * for what is going on with this.
35
+ */
36
+ declare type ProcedureModelConstructor<ProcedureModel extends IProcedureModel> = new (workspace: Workspace, name: string, id: string) => ProcedureModel;
37
+ /**
38
+ * A newable signature for an IParameterModel.
39
+ *
40
+ * Refer to
41
+ * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
42
+ * for what is going on with this.
43
+ */
44
+ declare type ParameterModelConstructor<ParameterModel extends IParameterModel> = new (workspace: Workspace, name: string, id: string) => ParameterModel;
45
+ /** Serializer for saving and loading procedure state. */
46
+ export declare class ProcedureSerializer<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel> implements ISerializer {
47
+ private readonly procedureModelClass;
48
+ private readonly parameterModelClass;
49
+ priority: number;
50
+ /**
51
+ * Constructs the procedure serializer.
52
+ *
53
+ * Example usage:
54
+ * new ProcedureSerializer(MyProcedureModelClass, MyParameterModelClass)
55
+ *
56
+ * @param procedureModelClass The class (implementing IProcedureModel) that
57
+ * you want this serializer to deserialize.
58
+ * @param parameterModelClass The class (implementing IParameterModel) that
59
+ * you want this serializer to deserialize.
60
+ */
61
+ constructor(procedureModelClass: ProcedureModelConstructor<ProcedureModel>, parameterModelClass: ParameterModelConstructor<ParameterModel>);
62
+ /** Serializes the procedure models of the given workspace. */
63
+ save(workspace: Workspace): State[] | null;
64
+ /**
65
+ * Deserializes the procedures models defined by the given state into the
66
+ * workspace.
67
+ */
68
+ load(state: State[], workspace: Workspace): void;
69
+ /** Disposes of any procedure models that exist on the workspace. */
70
+ clear(workspace: Workspace): void;
71
+ }
72
+ /**
73
+ * A ProcedureSerializer that deserializes to create the built-in
74
+ * ObservableProcedureModels and ObservableParameterModels.
75
+ */
76
+ export declare const observableProcedureSerializer: ProcedureSerializer<ObservableProcedureModel, ObservableParameterModel>;
77
+ export {};
78
+ //# sourceMappingURL=procedures.d.ts.map
@@ -3,6 +3,8 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { ISerializer } from '../interfaces/i_serializer.js';
7
+ import type { Workspace } from '../workspace.js';
6
8
  /**
7
9
  * Represents the state of a given variable.
8
10
  *
@@ -13,4 +15,35 @@ export interface State {
13
15
  id: string;
14
16
  type: string | undefined;
15
17
  }
18
+ /**
19
+ * Serializer for saving and loading variable state.
20
+ *
21
+ * @alias Blockly.serialization.variables.VariableSerializer
22
+ */
23
+ export declare class VariableSerializer implements ISerializer {
24
+ priority: number;
25
+ constructor();
26
+ /**
27
+ * Serializes the variables of the given workspace.
28
+ *
29
+ * @param workspace The workspace to save the variables of.
30
+ * @returns The state of the workspace's variables, or null if there are no
31
+ * variables.
32
+ */
33
+ save(workspace: Workspace): State[] | null;
34
+ /**
35
+ * Deserializes the variable defined by the given state into the given
36
+ * workspace.
37
+ *
38
+ * @param state The state of the variables to deserialize.
39
+ * @param workspace The workspace to deserialize into.
40
+ */
41
+ load(state: State[], workspace: Workspace): void;
42
+ /**
43
+ * Disposes of any variables that exist on the workspace.
44
+ *
45
+ * @param workspace The workspace to clear the variables of.
46
+ */
47
+ clear(workspace: Workspace): void;
48
+ }
16
49
  //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as blocks from './serialization/blocks.js';
7
+ import * as exceptions from './serialization/exceptions.js';
8
+ import * as priorities from './serialization/priorities.js';
9
+ import * as procedures from './serialization/procedures.js';
10
+ import * as registry from './serialization/registry.js';
11
+ import * as variables from './serialization/variables.js';
12
+ import * as workspaces from './serialization/workspaces.js';
13
+ import { ISerializer } from './interfaces/i_serializer.js';
14
+ export { blocks, exceptions, priorities, procedures, registry, variables, workspaces, ISerializer, };
15
+ //# sourceMappingURL=serialization.d.ts.map
package/core/theme.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export interface ITheme {
7
7
  blockStyles?: {
8
- [key: string]: BlockStyle;
8
+ [key: string]: Partial<BlockStyle>;
9
9
  };
10
10
  categoryStyles?: {
11
11
  [key: string]: CategoryStyle;
@@ -51,7 +51,7 @@ export declare class Theme implements ITheme {
51
51
  * @param opt_componentStyles A map of Blockly component names to style value.
52
52
  */
53
53
  constructor(name: string, opt_blockStyles?: {
54
- [key: string]: BlockStyle;
54
+ [key: string]: Partial<BlockStyle>;
55
55
  }, opt_categoryStyles?: {
56
56
  [key: string]: CategoryStyle;
57
57
  }, opt_componentStyles?: ComponentStyle);
@@ -115,9 +115,9 @@ export declare class Theme implements ITheme {
115
115
  export declare namespace Theme {
116
116
  interface BlockStyle {
117
117
  colourPrimary: string;
118
- colourSecondary?: string;
119
- colourTertiary?: string;
120
- hat?: string;
118
+ colourSecondary: string;
119
+ colourTertiary: string;
120
+ hat: string;
121
121
  }
122
122
  interface CategoryStyle {
123
123
  colour: string;
package/core/touch.d.ts CHANGED
@@ -73,9 +73,9 @@ export declare function shouldHandleEvent(e: Event | PseudoEvent): boolean;
73
73
  * Get the touch identifier from the given event. If it was a mouse event, the
74
74
  * identifier is the string 'mouse'.
75
75
  *
76
- * @param e Mouse event or touch event.
77
- * @returns The touch identifier from the first changed touch, if defined.
78
- * Otherwise 'mouse'.
76
+ * @param e Pointer event, mouse event, or touch event.
77
+ * @returns The pointerId, or touch identifier from the first changed touch, if
78
+ * defined. Otherwise 'mouse'.
79
79
  * @alias Blockly.Touch.getTouchIdentifierFromEvent
80
80
  */
81
81
  export declare function getTouchIdentifierFromEvent(e: Event | PseudoEvent): string;
package/core/warning.d.ts CHANGED
@@ -12,9 +12,9 @@ import { Icon } from './icon.js';
12
12
  * @alias Blockly.Warning
13
13
  */
14
14
  export declare class Warning extends Icon {
15
- private text_;
15
+ private text;
16
16
  /** The top-level node of the warning text, or null if not created. */
17
- private paragraphElement_;
17
+ private paragraphElement;
18
18
  /** Does this icon get hidden when the block is collapsed? */
19
19
  collapseHidden: boolean;
20
20
  /** @param block The block associated with this warning. */
@@ -32,9 +32,9 @@ export declare class Warning extends Icon {
32
32
  */
33
33
  setVisible(visible: boolean): void;
34
34
  /** Show the bubble. */
35
- private createBubble_;
35
+ private createBubble;
36
36
  /** Dispose of the bubble and references to it. */
37
- private disposeBubble_;
37
+ private disposeBubble;
38
38
  /**
39
39
  * Set this warning's text.
40
40
  *
@@ -14,6 +14,7 @@ import type * as toolbox from './utils/toolbox.js';
14
14
  import { VariableMap } from './variable_map.js';
15
15
  import type { VariableModel } from './variable_model.js';
16
16
  import type { WorkspaceComment } from './workspace_comment.js';
17
+ import { IProcedureMap } from './interfaces/i_procedure_map.js';
17
18
  /**
18
19
  * Class for a workspace. This is a data structure that contains blocks.
19
20
  * There is no UI, and can be created headlessly.
@@ -68,15 +69,16 @@ export declare class Workspace implements IASTNodeLocation {
68
69
  /** Set of databases for rapid lookup of connection locations. */
69
70
  connectionDBList: ConnectionDB[];
70
71
  connectionChecker: IConnectionChecker;
71
- private readonly topBlocks_;
72
- private readonly topComments_;
72
+ private readonly topBlocks;
73
+ private readonly topComments;
73
74
  private readonly commentDB;
74
- private readonly listeners_;
75
+ private readonly listeners;
75
76
  protected undoStack_: Abstract[];
76
77
  protected redoStack_: Abstract[];
77
78
  private readonly blockDB;
78
79
  private readonly typedBlocksDB;
79
- private variableMap_;
80
+ private variableMap;
81
+ private procedureMap;
80
82
  /**
81
83
  * Blocks in the flyout can refer to variables that don't exist in the main
82
84
  * workspace. For instance, the "get item in list" block refers to an
@@ -85,7 +87,7 @@ export declare class Workspace implements IASTNodeLocation {
85
87
  * these by tracking "potential" variables in the flyout. These variables
86
88
  * become real when references to them are dragged into the main workspace.
87
89
  */
88
- private potentialVariableMap_;
90
+ private potentialVariableMap;
89
91
  /** @param opt_options Dictionary of options. */
90
92
  constructor(opt_options?: Options);
91
93
  /**
@@ -419,6 +421,8 @@ export declare class Workspace implements IASTNodeLocation {
419
421
  * @internal
420
422
  */
421
423
  setVariableMap(variableMap: VariableMap): void;
424
+ /** Returns the map of all procedures on the workpace. */
425
+ getProcedureMap(): IProcedureMap;
422
426
  /**
423
427
  * Find the workspace with the specified ID.
424
428
  *