blockly 11.1.0 → 11.2.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 (158) hide show
  1. package/blockly.min.js +471 -448
  2. package/blockly.mjs +1 -0
  3. package/blockly_compressed.js +462 -439
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +9 -9
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +20 -14
  8. package/core/block_svg.d.ts +42 -9
  9. package/core/blockly.d.ts +11 -147
  10. package/core/blockly_options.d.ts +2 -2
  11. package/core/browser_events.d.ts +2 -2
  12. package/core/bubbles/bubble.d.ts +2 -2
  13. package/core/bubbles/mini_workspace_bubble.d.ts +3 -3
  14. package/core/bubbles/text_bubble.d.ts +1 -1
  15. package/core/bubbles/textinput_bubble.d.ts +1 -1
  16. package/core/bubbles.d.ts +2 -2
  17. package/core/clipboard/workspace_comment_paster.d.ts +3 -3
  18. package/core/clipboard.d.ts +2 -2
  19. package/core/comments/comment_view.d.ts +10 -3
  20. package/core/comments/rendered_workspace_comment.d.ts +10 -10
  21. package/core/comments/workspace_comment.d.ts +2 -2
  22. package/core/comments.d.ts +1 -1
  23. package/core/component_manager.d.ts +8 -0
  24. package/core/dragging/block_drag_strategy.d.ts +3 -1
  25. package/core/dragging/bubble_drag_strategy.d.ts +3 -1
  26. package/core/dragging/comment_drag_strategy.d.ts +8 -1
  27. package/core/dragging/dragger.d.ts +2 -2
  28. package/core/dragging.d.ts +2 -2
  29. package/core/dropdowndiv.d.ts +3 -3
  30. package/core/events/events.d.ts +67 -127
  31. package/core/events/events_abstract.d.ts +0 -1
  32. package/core/events/events_block_change.d.ts +2 -1
  33. package/core/events/events_block_create.d.ts +3 -2
  34. package/core/events/events_block_delete.d.ts +3 -2
  35. package/core/events/events_block_drag.d.ts +3 -2
  36. package/core/events/events_block_field_intermediate_change.d.ts +2 -1
  37. package/core/events/events_block_move.d.ts +3 -2
  38. package/core/events/events_bubble_open.d.ts +4 -3
  39. package/core/events/events_click.d.ts +3 -2
  40. package/core/events/events_comment_base.d.ts +1 -1
  41. package/core/events/events_comment_change.d.ts +8 -2
  42. package/core/events/events_comment_collapse.d.ts +3 -2
  43. package/core/events/events_comment_create.d.ts +8 -2
  44. package/core/events/events_comment_delete.d.ts +8 -2
  45. package/core/events/events_comment_drag.d.ts +51 -0
  46. package/core/events/events_comment_move.d.ts +9 -3
  47. package/core/events/events_comment_resize.d.ts +68 -0
  48. package/core/events/events_marker_move.d.ts +2 -1
  49. package/core/events/events_selected.d.ts +3 -2
  50. package/core/events/events_theme_change.d.ts +3 -2
  51. package/core/events/events_toolbox_item_select.d.ts +3 -2
  52. package/core/events/events_trashcan_open.d.ts +3 -2
  53. package/core/events/events_var_base.d.ts +1 -1
  54. package/core/events/events_var_create.d.ts +3 -2
  55. package/core/events/events_var_delete.d.ts +3 -2
  56. package/core/events/events_var_rename.d.ts +3 -2
  57. package/core/events/events_viewport.d.ts +3 -2
  58. package/core/events/predicates.d.ts +90 -0
  59. package/core/events/type.d.ts +79 -0
  60. package/core/events/utils.d.ts +93 -125
  61. package/core/events/workspace_events.d.ts +2 -1
  62. package/core/extensions.d.ts +1 -1
  63. package/core/field.d.ts +1 -1
  64. package/core/field_input.d.ts +1 -1
  65. package/core/field_label.d.ts +6 -0
  66. package/core/flyout_base.d.ts +1 -1
  67. package/core/flyout_button.d.ts +6 -1
  68. package/core/generator.d.ts +3 -2
  69. package/core/gesture.d.ts +3 -3
  70. package/core/grid.d.ts +7 -1
  71. package/core/icons/comment_icon.d.ts +3 -3
  72. package/core/icons/icon.d.ts +1 -1
  73. package/core/icons/mutator_icon.d.ts +3 -3
  74. package/core/icons/warning_icon.d.ts +2 -2
  75. package/core/icons.d.ts +5 -5
  76. package/core/inputs/input.d.ts +1 -1
  77. package/core/inputs.d.ts +3 -3
  78. package/core/interfaces/i_ast_node_location_with_block.d.ts +1 -1
  79. package/core/interfaces/i_comment_icon.d.ts +2 -2
  80. package/core/interfaces/i_drag_target.d.ts +1 -1
  81. package/core/interfaces/i_flyout.d.ts +3 -3
  82. package/core/interfaces/i_legacy_procedure_blocks.d.ts +2 -2
  83. package/core/interfaces/i_metrics_manager.d.ts +2 -2
  84. package/core/interfaces/i_positionable.d.ts +1 -1
  85. package/core/interfaces/i_selectable.d.ts +1 -1
  86. package/core/interfaces/i_serializer.d.ts +2 -2
  87. package/core/interfaces/i_toolbox.d.ts +3 -3
  88. package/core/keyboard_nav/ast_node.d.ts +1 -1
  89. package/core/layer_manager.d.ts +1 -1
  90. package/core/layers.d.ts +0 -2
  91. package/core/procedures.d.ts +3 -3
  92. package/core/registry.d.ts +6 -6
  93. package/core/renderers/common/block_rendering.d.ts +3 -30
  94. package/core/renderers/common/i_path_object.d.ts +2 -2
  95. package/core/renderers/common/info.d.ts +1 -1
  96. package/core/renderers/common/marker_svg.d.ts +5 -5
  97. package/core/renderers/zelos/constants.d.ts +1 -1
  98. package/core/serialization/procedures.d.ts +2 -2
  99. package/core/serialization/workspace_comments.d.ts +1 -1
  100. package/core/serialization.d.ts +3 -3
  101. package/core/toolbox/toolbox.d.ts +1 -6
  102. package/core/tooltip.d.ts +1 -1
  103. package/core/trashcan.d.ts +1 -6
  104. package/core/utils/size.d.ts +1 -1
  105. package/core/variables_dynamic.d.ts +1 -1
  106. package/core/workspace.d.ts +4 -5
  107. package/core/workspace_svg.d.ts +3 -3
  108. package/core/xml.d.ts +1 -1
  109. package/dart_compressed.js.map +1 -1
  110. package/generators/dart/dart_generator.d.ts +4 -0
  111. package/generators/dart/lists.d.ts +0 -3
  112. package/generators/dart/procedures.d.ts +0 -3
  113. package/generators/dart/text.d.ts +0 -3
  114. package/generators/javascript/javascript_generator.d.ts +4 -0
  115. package/generators/javascript/lists.d.ts +0 -3
  116. package/generators/javascript/procedures.d.ts +0 -3
  117. package/generators/javascript/text.d.ts +0 -3
  118. package/generators/lua/lists.d.ts +0 -3
  119. package/generators/lua/lua_generator.d.ts +6 -0
  120. package/generators/lua/procedures.d.ts +0 -3
  121. package/generators/lua/text.d.ts +0 -3
  122. package/generators/lua.d.ts +0 -4
  123. package/generators/php/lists.d.ts +1 -1
  124. package/generators/php/logic.d.ts +1 -1
  125. package/generators/php/math.d.ts +1 -1
  126. package/generators/php/php_generator.d.ts +4 -0
  127. package/generators/php/procedures.d.ts +1 -1
  128. package/generators/php/text.d.ts +1 -4
  129. package/generators/php/variables.d.ts +1 -1
  130. package/generators/php.d.ts +0 -5
  131. package/generators/python/lists.d.ts +1 -1
  132. package/generators/python/procedures.d.ts +1 -1
  133. package/generators/python/python_generator.d.ts +4 -0
  134. package/generators/python/text.d.ts +1 -1
  135. package/generators/python.d.ts +0 -5
  136. package/index.mjs +1 -0
  137. package/javascript_compressed.js.map +1 -1
  138. package/lua_compressed.js.map +1 -1
  139. package/media/1x1.gif +0 -0
  140. package/media/click.mp3 +0 -0
  141. package/media/click.ogg +0 -0
  142. package/media/click.wav +0 -0
  143. package/media/delete.mp3 +0 -0
  144. package/media/delete.ogg +0 -0
  145. package/media/delete.wav +0 -0
  146. package/media/disconnect.mp3 +0 -0
  147. package/media/disconnect.ogg +0 -0
  148. package/media/disconnect.wav +0 -0
  149. package/media/handclosed.cur +0 -0
  150. package/media/handdelete.cur +0 -0
  151. package/media/handopen.cur +0 -0
  152. package/media/pilcrow.png +0 -0
  153. package/media/quote0.png +0 -0
  154. package/media/quote1.png +0 -0
  155. package/media/sprites.png +0 -0
  156. package/package.json +14 -11
  157. package/php_compressed.js.map +1 -1
  158. package/python_compressed.js.map +1 -1
@@ -10,6 +10,7 @@ import type { BlockCreate } from './events_block_create.js';
10
10
  import type { BlockMove } from './events_block_move.js';
11
11
  import type { CommentCreate } from './events_comment_create.js';
12
12
  import type { CommentMove } from './events_comment_move.js';
13
+ import type { CommentResize } from './events_comment_resize.js';
13
14
  /**
14
15
  * Sets whether events should be added to the undo stack.
15
16
  *
@@ -22,117 +23,6 @@ export declare function setRecordUndo(newValue: boolean): void;
22
23
  * @returns True if events will be added to the undo stack.
23
24
  */
24
25
  export declare function getRecordUndo(): boolean;
25
- /**
26
- * Name of event that creates a block. Will be deprecated for BLOCK_CREATE.
27
- */
28
- export declare const CREATE = "create";
29
- /**
30
- * Name of event that creates a block.
31
- */
32
- export declare const BLOCK_CREATE = "create";
33
- /**
34
- * Name of event that deletes a block. Will be deprecated for BLOCK_DELETE.
35
- */
36
- export declare const DELETE = "delete";
37
- /**
38
- * Name of event that deletes a block.
39
- */
40
- export declare const BLOCK_DELETE = "delete";
41
- /**
42
- * Name of event that changes a block. Will be deprecated for BLOCK_CHANGE.
43
- */
44
- export declare const CHANGE = "change";
45
- /**
46
- * Name of event that changes a block.
47
- */
48
- export declare const BLOCK_CHANGE = "change";
49
- /**
50
- * Name of event representing an in-progress change to a field of a block, which
51
- * is expected to be followed by a block change event.
52
- */
53
- export declare const BLOCK_FIELD_INTERMEDIATE_CHANGE = "block_field_intermediate_change";
54
- /**
55
- * Name of event that moves a block. Will be deprecated for BLOCK_MOVE.
56
- */
57
- export declare const MOVE = "move";
58
- /**
59
- * Name of event that moves a block.
60
- */
61
- export declare const BLOCK_MOVE = "move";
62
- /**
63
- * Name of event that creates a variable.
64
- */
65
- export declare const VAR_CREATE = "var_create";
66
- /**
67
- * Name of event that deletes a variable.
68
- */
69
- export declare const VAR_DELETE = "var_delete";
70
- /**
71
- * Name of event that renames a variable.
72
- */
73
- export declare const VAR_RENAME = "var_rename";
74
- /**
75
- * Name of generic event that records a UI change.
76
- */
77
- export declare const UI = "ui";
78
- /**
79
- * Name of event that record a block drags a block.
80
- */
81
- export declare const BLOCK_DRAG = "drag";
82
- /**
83
- * Name of event that records a change in selected element.
84
- */
85
- export declare const SELECTED = "selected";
86
- /**
87
- * Name of event that records a click.
88
- */
89
- export declare const CLICK = "click";
90
- /**
91
- * Name of event that records a marker move.
92
- */
93
- export declare const MARKER_MOVE = "marker_move";
94
- /**
95
- * Name of event that records a bubble open.
96
- */
97
- export declare const BUBBLE_OPEN = "bubble_open";
98
- /**
99
- * Name of event that records a trashcan open.
100
- */
101
- export declare const TRASHCAN_OPEN = "trashcan_open";
102
- /**
103
- * Name of event that records a toolbox item select.
104
- */
105
- export declare const TOOLBOX_ITEM_SELECT = "toolbox_item_select";
106
- /**
107
- * Name of event that records a theme change.
108
- */
109
- export declare const THEME_CHANGE = "theme_change";
110
- /**
111
- * Name of event that records a viewport change.
112
- */
113
- export declare const VIEWPORT_CHANGE = "viewport_change";
114
- /**
115
- * Name of event that creates a comment.
116
- */
117
- export declare const COMMENT_CREATE = "comment_create";
118
- /**
119
- * Name of event that deletes a comment.
120
- */
121
- export declare const COMMENT_DELETE = "comment_delete";
122
- /**
123
- * Name of event that changes a comment.
124
- */
125
- export declare const COMMENT_CHANGE = "comment_change";
126
- /**
127
- * Name of event that moves a comment.
128
- */
129
- export declare const COMMENT_MOVE = "comment_move";
130
- /** Type of event that moves a comment. */
131
- export declare const COMMENT_COLLAPSE = "comment_collapse";
132
- /**
133
- * Name of event that records a workspace load.
134
- */
135
- export declare const FINISHED_LOADING = "finished_loading";
136
26
  /**
137
27
  * Type of events that cause objects to be bumped back into the visible
138
28
  * portion of the workspace.
@@ -140,35 +30,112 @@ export declare const FINISHED_LOADING = "finished_loading";
140
30
  * Not to be confused with bumping so that disconnected connections do not
141
31
  * appear connected.
142
32
  */
143
- export type BumpEvent = BlockCreate | BlockMove | CommentCreate | CommentMove;
33
+ export type BumpEvent = BlockCreate | BlockMove | CommentCreate | CommentMove | CommentResize;
144
34
  /**
145
- * List of events that cause objects to be bumped back into the visible
146
- * portion of the workspace.
35
+ * Enqueue an event to be dispatched to change listeners.
147
36
  *
148
- * Not to be confused with bumping so that disconnected connections do not
149
- * appear connected.
150
- */
151
- export declare const BUMP_EVENTS: string[];
152
- /**
153
- * Create a custom event and fire it.
37
+ * Notes:
154
38
  *
155
- * @param event Custom data for event.
39
+ * - Events are enqueued until a timeout, generally after rendering is
40
+ * complete or at the end of the current microtask, if not running
41
+ * in a browser.
42
+ * - Queued events are subject to destructive modification by being
43
+ * combined with later-enqueued events, but only until they are
44
+ * fired.
45
+ * - Events are dispatched via the fireChangeListener method on the
46
+ * affected workspace.
47
+ *
48
+ * @param event Any Blockly event.
156
49
  */
157
50
  export declare function fire(event: Abstract): void;
158
51
  /**
159
52
  * Private version of fireInternal for stubbing in tests.
160
53
  */
161
54
  declare function fireInternal(event: Abstract): void;
162
- /** Fire all queued events. */
55
+ /** Dispatch all queued events. */
163
56
  declare function fireNow(): void;
164
57
  /**
165
- * Filter the queued events and merge duplicates.
58
+ * Enqueue an event on FIRE_QUEUE.
59
+ *
60
+ * Normally this is equivalent to FIRE_QUEUE.push(event), but if the
61
+ * enqueued event is a BlockChange event and the most recent event(s)
62
+ * on the queue are BlockMove events that (re)connect other blocks to
63
+ * the changed block (and belong to the same event group) then the
64
+ * enqueued event will be enqueued before those events rather than
65
+ * after.
66
+ *
67
+ * This is a workaround for a problem caused by the fact that
68
+ * MutatorIcon.prototype.recomposeSourceBlock can only fire a
69
+ * BlockChange event after the mutating block's compose method
70
+ * returns, meaning that if the compose method reconnects child blocks
71
+ * the corresponding BlockMove events are emitted _before_ the
72
+ * BlockChange event, causing issues with undo, mirroring, etc.; see
73
+ * https://github.com/google/blockly/issues/8225#issuecomment-2195751783
74
+ * (and following) for details.
75
+ */
76
+ declare function enqueueEvent(event: Abstract): void;
77
+ /**
78
+ * Filter the queued events by merging duplicates, removing null
79
+ * events and reording BlockChange events.
80
+ *
81
+ * History of this function:
82
+ *
83
+ * This function was originally added in commit cf257ea5 with the
84
+ * intention of dramatically reduing the total number of dispatched
85
+ * events. Initialy it affected only BlockMove events but others were
86
+ * added over time.
87
+ *
88
+ * Code was added to reorder BlockChange events added in commit
89
+ * 5578458, for uncertain reasons but most probably as part of an
90
+ * only-partially-successful attemp to fix problems with event
91
+ * ordering during block mutations. This code should probably have
92
+ * been added to the top of the function, before merging and
93
+ * null-removal, but was added at the bottom for now-forgotten
94
+ * reasons. See these bug investigations for a fuller discussion of
95
+ * the underlying issue and some of the failures that arose because of
96
+ * this incomplete/incorrect fix:
97
+ *
98
+ * https://github.com/google/blockly/issues/8225#issuecomment-2195751783
99
+ * https://github.com/google/blockly/issues/2037#issuecomment-2209696351
100
+ *
101
+ * Later, in PR #1205 the original O(n^2) implementation was replaced
102
+ * by a linear-time implementation, though additonal fixes were made
103
+ * subsequently.
104
+ *
105
+ * In August 2024 a number of significant simplifications were made:
106
+ *
107
+ * This function was previously called from Workspace.prototype.undo,
108
+ * but the mutation of events by this function was the cause of issue
109
+ * #7026 (note that events would combine differently in reverse order
110
+ * vs. forward order). The originally-chosen fix for this was the
111
+ * addition (in PR #7069) of code to fireNow to post-filter the
112
+ * .undoStack_ and .redoStack_ of any workspace that had just been
113
+ * involved in dispatching events; this apparently resolved the issue
114
+ * but added considerable additional complexity and made it difficult
115
+ * to reason about how events are processed for undo/redo, so both the
116
+ * call from undo and the post-processing code was removed, and
117
+ * forward=true was made the default while calling the function with
118
+ * forward=false was deprecated.
119
+ *
120
+ * At the same time, the buggy code to reorder BlockChange events was
121
+ * replaced by a less-buggy version of the same functionality in a new
122
+ * function, enqueueEvent, called from fireInternal, thus assuring
123
+ * that events will be in the correct order at the time filter is
124
+ * called.
125
+ *
126
+ * Additionally, the event merging code was modified so that only
127
+ * immediately adjacent events would be merged. This simplified the
128
+ * implementation while ensuring that the merging of events cannot
129
+ * cause them to be reordered.
166
130
  *
167
- * @param queueIn Array of events.
131
+ * @param queue Array of events.
168
132
  * @param forward True if forward (redo), false if backward (undo).
133
+ * This parameter is deprecated: true is now the default and
134
+ * calling filter with it set to false will in future not be
135
+ * supported.
169
136
  * @returns Array of filtered events.
170
137
  */
171
- export declare function filter(queueIn: Abstract[], forward: boolean): Abstract[];
138
+ export declare function filter(queue: Abstract[], forward?: boolean): Abstract[];
172
139
  /**
173
140
  * Modify pending undo events so that when they are fired they don't land
174
141
  * in the undo stack. Called by Workspace.clearUndo.
@@ -239,6 +206,7 @@ export declare function get(eventType: string): new (...p1: any[]) => Abstract;
239
206
  export declare function disableOrphans(event: Abstract): void;
240
207
  export declare const TEST_ONLY: {
241
208
  FIRE_QUEUE: Abstract[];
209
+ enqueueEvent: typeof enqueueEvent;
242
210
  fireNow: typeof fireNow;
243
211
  fireInternal: typeof fireInternal;
244
212
  setGroupInternal: typeof setGroupInternal;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { Workspace } from '../workspace.js';
7
7
  import { Abstract as AbstractEvent } from './events_abstract.js';
8
+ import { EventType } from './type.js';
8
9
  /**
9
10
  * Notifies listeners when the workspace has finished deserializing from
10
11
  * JSON/XML.
@@ -12,7 +13,7 @@ import { Abstract as AbstractEvent } from './events_abstract.js';
12
13
  export declare class FinishedLoading extends AbstractEvent {
13
14
  isBlank: boolean;
14
15
  recordUndo: boolean;
15
- type: string;
16
+ type: EventType;
16
17
  /**
17
18
  * @param opt_workspace The workspace that has finished loading. Undefined
18
19
  * for a blank event.
@@ -18,7 +18,7 @@ export declare const TEST_ONLY: {
18
18
  * @throws {Error} if the extension name is empty, the extension is already
19
19
  * registered, or extensionFn is not a function.
20
20
  */
21
- export declare function register(name: string, initFn: Function): void;
21
+ export declare function register<T extends Block>(name: string, initFn: (this: T) => void): void;
22
22
  /**
23
23
  * Registers a new extension function that adds all key/value of mixinObj.
24
24
  *
package/core/field.d.ts CHANGED
@@ -17,13 +17,13 @@ import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.j
17
17
  import type { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
18
18
  import type { IKeyboardAccessible } from './interfaces/i_keyboard_accessible.js';
19
19
  import type { IRegistrable } from './interfaces/i_registrable.js';
20
+ import { ISerializable } from './interfaces/i_serializable.js';
20
21
  import type { ConstantProvider } from './renderers/common/constants.js';
21
22
  import type { KeyboardShortcut } from './shortcut_registry.js';
22
23
  import * as Tooltip from './tooltip.js';
23
24
  import type { Coordinate } from './utils/coordinate.js';
24
25
  import { Rect } from './utils/rect.js';
25
26
  import { Size } from './utils/size.js';
26
- import { ISerializable } from './interfaces/i_serializable.js';
27
27
  /**
28
28
  * A function that is called to validate changes to the field's value before
29
29
  * they are set.
@@ -10,8 +10,8 @@
10
10
  */
11
11
  import './events/events_block_change.js';
12
12
  import { Field, FieldConfig, FieldValidator } from './field.js';
13
- import type { WorkspaceSvg } from './workspace_svg.js';
14
13
  import { Size } from './utils/size.js';
14
+ import type { WorkspaceSvg } from './workspace_svg.js';
15
15
  /**
16
16
  * Supported types for FieldInput subclasses.
17
17
  *
@@ -3,6 +3,12 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Non-editable, non-serializable text field. Used for titles,
8
+ * labels, etc.
9
+ *
10
+ * @class
11
+ */
6
12
  import { Field, FieldConfig } from './field.js';
7
13
  /**
8
14
  * Class for a non-editable, non-serializable text field.
@@ -6,6 +6,7 @@
6
6
  import { BlockSvg } from './block_svg.js';
7
7
  import { DeleteArea } from './delete_area.js';
8
8
  import { FlyoutButton } from './flyout_button.js';
9
+ import { IAutoHideable } from './interfaces/i_autohideable.js';
9
10
  import type { IFlyout } from './interfaces/i_flyout.js';
10
11
  import type { Options } from './options.js';
11
12
  import * as blocks from './serialization/blocks.js';
@@ -13,7 +14,6 @@ import { Coordinate } from './utils/coordinate.js';
13
14
  import { Svg } from './utils/svg.js';
14
15
  import * as toolbox from './utils/toolbox.js';
15
16
  import { WorkspaceSvg } from './workspace_svg.js';
16
- import { IAutoHideable } from './interfaces/i_autohideable.js';
17
17
  declare enum FlyoutItemType {
18
18
  BLOCK = "block",
19
19
  BUTTON = "button"
@@ -3,10 +3,15 @@
3
3
  * Copyright 2016 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for a button in the flyout.
8
+ *
9
+ * @class
10
+ */
11
+ import type { IASTNodeLocationSvg } from './blockly.js';
6
12
  import { Coordinate } from './utils/coordinate.js';
7
13
  import type * as toolbox from './utils/toolbox.js';
8
14
  import type { WorkspaceSvg } from './workspace_svg.js';
9
- import type { IASTNodeLocationSvg } from './blockly.js';
10
15
  /**
11
16
  * Class for a button or label in the flyout.
12
17
  */
@@ -149,8 +149,8 @@ export declare class CodeGenerator {
149
149
  * @param name The name of the input.
150
150
  * @param outerOrder The maximum binding strength (minimum order value) of any
151
151
  * operators adjacent to "block".
152
- * @returns Generated code or '' if no blocks are connected or the specified
153
- * input does not exist.
152
+ * @returns Generated code or '' if no blocks are connected.
153
+ * @throws ReferenceError if the specified input does not exist.
154
154
  */
155
155
  valueToCode(block: Block, name: string, outerOrder: number): string;
156
156
  /**
@@ -162,6 +162,7 @@ export declare class CodeGenerator {
162
162
  * @param block The block containing the input.
163
163
  * @param name The name of the input.
164
164
  * @returns Generated code or '' if no blocks are connected.
165
+ * @throws ReferenceError if the specified input does not exist.
165
166
  */
166
167
  statementToCode(block: Block, name: string): string;
167
168
  /**
package/core/gesture.d.ts CHANGED
@@ -11,15 +11,15 @@
11
11
  */
12
12
  import './events/events_click.js';
13
13
  import type { BlockSvg } from './block_svg.js';
14
+ import { RenderedWorkspaceComment } from './comments.js';
14
15
  import type { Field } from './field.js';
15
16
  import type { IBubble } from './interfaces/i_bubble.js';
17
+ import { IDragger } from './interfaces/i_dragger.js';
16
18
  import type { IFlyout } from './interfaces/i_flyout.js';
19
+ import type { IIcon } from './interfaces/i_icon.js';
17
20
  import { Coordinate } from './utils/coordinate.js';
18
21
  import { WorkspaceDragger } from './workspace_dragger.js';
19
22
  import type { WorkspaceSvg } from './workspace_svg.js';
20
- import type { IIcon } from './interfaces/i_icon.js';
21
- import { IDragger } from './interfaces/i_dragger.js';
22
- import { RenderedWorkspaceComment } from './comments.js';
23
23
  /**
24
24
  * Class for one gesture.
25
25
  */
package/core/grid.d.ts CHANGED
@@ -3,8 +3,14 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Coordinate } from './utils/coordinate.js';
6
+ /**
7
+ * Object for configuring and updating a workspace grid in
8
+ * Blockly.
9
+ *
10
+ * @class
11
+ */
7
12
  import { GridOptions } from './options.js';
13
+ import { Coordinate } from './utils/coordinate.js';
8
14
  /**
9
15
  * Class for a workspace's grid.
10
16
  */
@@ -4,12 +4,12 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Block } from '../block.js';
7
- import { IconType } from './icon_types.js';
8
- import { Coordinate } from '../utils.js';
9
- import { Icon } from './icon.js';
10
7
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
11
8
  import type { ISerializable } from '../interfaces/i_serializable.js';
9
+ import { Coordinate } from '../utils.js';
12
10
  import { Size } from '../utils/size.js';
11
+ import { Icon } from './icon.js';
12
+ import { IconType } from './icon_types.js';
13
13
  /**
14
14
  * An icon which allows the user to add comment text to a block.
15
15
  */
@@ -5,10 +5,10 @@
5
5
  */
6
6
  import type { Block } from '../block.js';
7
7
  import type { IIcon } from '../interfaces/i_icon.js';
8
+ import * as tooltip from '../tooltip.js';
8
9
  import { Coordinate } from '../utils/coordinate.js';
9
10
  import { Size } from '../utils/size.js';
10
11
  import type { IconType } from './icon_types.js';
11
- import * as tooltip from '../tooltip.js';
12
12
  /**
13
13
  * The abstract icon class. Icons are visual elements that live in the top-start
14
14
  * corner of the block. Usually they provide more "meta" information about a
@@ -3,13 +3,13 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { Abstract } from '../events/events_abstract.js';
7
6
  import type { BlockSvg } from '../block_svg.js';
8
- import { Coordinate } from '../utils/coordinate.js';
7
+ import type { Abstract } from '../events/events_abstract.js';
9
8
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
10
- import { Icon } from './icon.js';
9
+ import { Coordinate } from '../utils/coordinate.js';
11
10
  import { Size } from '../utils/size.js';
12
11
  import type { WorkspaceSvg } from '../workspace_svg.js';
12
+ import { Icon } from './icon.js';
13
13
  import { IconType } from './icon_types.js';
14
14
  /**
15
15
  * An icon that allows the user to change the shape of the block.
@@ -4,10 +4,10 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { BlockSvg } from '../block_svg.js';
7
- import { Coordinate } from '../utils/coordinate.js';
8
- import { Icon } from './icon.js';
9
7
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
10
8
  import { Size } from '../utils.js';
9
+ import { Coordinate } from '../utils/coordinate.js';
10
+ import { Icon } from './icon.js';
11
11
  import { IconType } from './icon_types.js';
12
12
  /**
13
13
  * An icon that warns the user that something is wrong with their block.
package/core/icons.d.ts CHANGED
@@ -3,12 +3,12 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Icon } from './icons/icon.js';
7
6
  import { CommentIcon, CommentState } from './icons/comment_icon.js';
8
- import { MutatorIcon } from './icons/mutator_icon.js';
9
- import { WarningIcon } from './icons/warning_icon.js';
10
- import { IconType } from './icons/icon_types.js';
11
7
  import * as exceptions from './icons/exceptions.js';
8
+ import { Icon } from './icons/icon.js';
9
+ import { IconType } from './icons/icon_types.js';
10
+ import { MutatorIcon } from './icons/mutator_icon.js';
12
11
  import * as registry from './icons/registry.js';
13
- export { Icon, CommentIcon, CommentState, MutatorIcon, WarningIcon, IconType, exceptions, registry, };
12
+ import { WarningIcon } from './icons/warning_icon.js';
13
+ export { CommentIcon, CommentState, exceptions, Icon, IconType, MutatorIcon, registry, WarningIcon, };
14
14
  //# sourceMappingURL=icons.d.ts.map
@@ -14,8 +14,8 @@ import type { BlockSvg } from '../block_svg.js';
14
14
  import type { Connection } from '../connection.js';
15
15
  import type { ConnectionType } from '../connection_type.js';
16
16
  import type { Field } from '../field.js';
17
- import { inputTypes } from './input_types.js';
18
17
  import { Align } from './align.js';
18
+ import { inputTypes } from './input_types.js';
19
19
  /** Class for an input with optional fields. */
20
20
  export declare class Input {
21
21
  name: string;
package/core/inputs.d.ts CHANGED
@@ -4,11 +4,11 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Align } from './inputs/align.js';
7
- import { Input } from './inputs/input.js';
8
7
  import { DummyInput } from './inputs/dummy_input.js';
9
8
  import { EndRowInput } from './inputs/end_row_input.js';
9
+ import { Input } from './inputs/input.js';
10
+ import { inputTypes } from './inputs/input_types.js';
10
11
  import { StatementInput } from './inputs/statement_input.js';
11
12
  import { ValueInput } from './inputs/value_input.js';
12
- import { inputTypes } from './inputs/input_types.js';
13
- export { Align, Input, DummyInput, EndRowInput, StatementInput, ValueInput, inputTypes, };
13
+ export { Align, DummyInput, EndRowInput, Input, inputTypes, StatementInput, ValueInput, };
14
14
  //# sourceMappingURL=inputs.d.ts.map
@@ -3,8 +3,8 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { IASTNodeLocation } from './i_ast_node_location.js';
7
6
  import type { Block } from '../block.js';
7
+ import type { IASTNodeLocation } from './i_ast_node_location.js';
8
8
  /**
9
9
  * An AST node location that has an associated block.
10
10
  */
@@ -4,9 +4,9 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { CommentState } from '../icons/comment_icon.js';
7
- import { IIcon } from './i_icon.js';
8
7
  import { Size } from '../utils/size.js';
9
8
  import { IHasBubble } from './i_has_bubble.js';
9
+ import { IIcon } from './i_icon.js';
10
10
  import { ISerializable } from './i_serializable.js';
11
11
  export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
12
12
  setText(text: string): void;
@@ -17,5 +17,5 @@ export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
17
17
  loadState(state: CommentState): void;
18
18
  }
19
19
  /** Checks whether the given object is an ICommentIcon. */
20
- export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
20
+ export declare function isCommentIcon(obj: object): obj is ICommentIcon;
21
21
  //# sourceMappingURL=i_comment_icon.d.ts.map
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Rect } from '../utils/rect.js';
7
- import { IDraggable } from './i_draggable.js';
8
7
  import type { IComponent } from './i_component.js';
8
+ import { IDraggable } from './i_draggable.js';
9
9
  /**
10
10
  * Interface for a component with custom behaviour when a block or bubble is
11
11
  * dragged over or dropped on top of it.
@@ -3,13 +3,13 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { WorkspaceSvg } from '../workspace_svg.js';
7
6
  import type { BlockSvg } from '../block_svg.js';
7
+ import { FlyoutItem } from '../flyout_base.js';
8
8
  import type { Coordinate } from '../utils/coordinate.js';
9
- import type { FlyoutDefinition } from '../utils/toolbox.js';
10
9
  import type { Svg } from '../utils/svg.js';
10
+ import type { FlyoutDefinition } from '../utils/toolbox.js';
11
+ import type { WorkspaceSvg } from '../workspace_svg.js';
11
12
  import type { IRegistrable } from './i_registrable.js';
12
- import { FlyoutItem } from '../flyout_base.js';
13
13
  /**
14
14
  * Interface for a flyout.
15
15
  */
@@ -23,12 +23,12 @@ export interface LegacyProcedureDefBlock {
23
23
  getProcedureDef: () => ProcedureTuple;
24
24
  }
25
25
  /** @internal */
26
- export declare function isLegacyProcedureDefBlock(block: Object): block is LegacyProcedureDefBlock;
26
+ export declare function isLegacyProcedureDefBlock(block: object): block is LegacyProcedureDefBlock;
27
27
  /** @internal */
28
28
  export interface LegacyProcedureCallBlock {
29
29
  getProcedureCall: () => string;
30
30
  renameProcedure: (p1: string, p2: string) => void;
31
31
  }
32
32
  /** @internal */
33
- export declare function isLegacyProcedureCallBlock(block: Object): block is LegacyProcedureCallBlock;
33
+ export declare function isLegacyProcedureCallBlock(block: object): block is LegacyProcedureCallBlock;
34
34
  //# sourceMappingURL=i_legacy_procedure_blocks.d.ts.map
@@ -3,9 +3,9 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { ContainerRegion, ToolboxMetrics, AbsoluteMetrics, UiMetrics } from '../metrics_manager.js';
7
- import type { Size } from '../utils/size.js';
6
+ import type { AbsoluteMetrics, ContainerRegion, ToolboxMetrics, UiMetrics } from '../metrics_manager.js';
8
7
  import type { Metrics } from '../utils/metrics.js';
8
+ import type { Size } from '../utils/size.js';
9
9
  /**
10
10
  * Interface for a metrics manager.
11
11
  */
@@ -3,8 +3,8 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { Rect } from '../utils/rect.js';
7
6
  import type { UiMetrics } from '../metrics_manager.js';
7
+ import type { Rect } from '../utils/rect.js';
8
8
  import type { IComponent } from './i_component.js';
9
9
  /**
10
10
  * Interface for a component that is positioned on top of the workspace.
@@ -16,5 +16,5 @@ export interface ISelectable {
16
16
  unselect(): void;
17
17
  }
18
18
  /** Checks whether the given object is an ISelectable. */
19
- export declare function isSelectable(obj: Object): obj is ISelectable;
19
+ export declare function isSelectable(obj: object): obj is ISelectable;
20
20
  //# sourceMappingURL=i_selectable.d.ts.map
@@ -24,7 +24,7 @@ export interface ISerializer {
24
24
  * @returns A JS object containing the system's state, or null if there is no
25
25
  * state to record.
26
26
  */
27
- save(workspace: Workspace): Object | null;
27
+ save(workspace: Workspace): object | null;
28
28
  /**
29
29
  * Loads the state of the plugin or system.
30
30
  *
@@ -33,7 +33,7 @@ export interface ISerializer {
33
33
  * @param workspace The workspace the system to deserialize is associated
34
34
  * with.
35
35
  */
36
- load(state: Object, workspace: Workspace): void;
36
+ load(state: object, workspace: Workspace): void;
37
37
  /**
38
38
  * Clears the state of the plugin or system.
39
39
  *