blockly 10.2.0-beta.1 → 10.2.0-beta.2

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 (84) hide show
  1. package/blockly.min.js +1726 -1899
  2. package/blockly_compressed.js +1463 -1614
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +162 -173
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +10 -0
  7. package/core/block_dragger.d.ts +5 -0
  8. package/core/block_svg.d.ts +14 -4
  9. package/core/component_manager.d.ts +5 -0
  10. package/core/connection.d.ts +5 -0
  11. package/core/contextmenu.d.ts +5 -3
  12. package/core/contextmenu_registry.d.ts +7 -2
  13. package/core/drag_target.d.ts +6 -0
  14. package/core/dropdowndiv.d.ts +5 -0
  15. package/core/events/events_block_base.d.ts +5 -0
  16. package/core/events/events_block_change.d.ts +5 -0
  17. package/core/events/events_block_create.d.ts +5 -0
  18. package/core/events/events_block_delete.d.ts +5 -0
  19. package/core/events/events_block_drag.d.ts +5 -0
  20. package/core/events/events_block_field_intermediate_change.d.ts +6 -0
  21. package/core/events/events_block_move.d.ts +5 -0
  22. package/core/events/events_bubble_open.d.ts +5 -0
  23. package/core/events/events_click.d.ts +5 -0
  24. package/core/events/events_marker_move.d.ts +5 -0
  25. package/core/events/events_ui_base.d.ts +6 -0
  26. package/core/events/events_var_base.d.ts +5 -0
  27. package/core/field.d.ts +17 -3
  28. package/core/field_checkbox.d.ts +5 -0
  29. package/core/field_colour.d.ts +27 -7
  30. package/core/field_image.d.ts +5 -0
  31. package/core/field_input.d.ts +19 -1
  32. package/core/field_label_serializable.d.ts +7 -0
  33. package/core/field_number.d.ts +5 -0
  34. package/core/field_textinput.d.ts +5 -0
  35. package/core/field_variable.d.ts +5 -0
  36. package/core/flyout_metrics_manager.d.ts +5 -0
  37. package/core/generator.d.ts +29 -1
  38. package/core/gesture.d.ts +6 -0
  39. package/core/icons/mutator_icon.d.ts +8 -0
  40. package/core/inputs/input.d.ts +5 -0
  41. package/core/keyboard_nav/ast_node.d.ts +6 -0
  42. package/core/keyboard_nav/marker.d.ts +6 -0
  43. package/core/main.d.ts +6 -4
  44. package/core/marker_manager.d.ts +5 -0
  45. package/core/menuitem.d.ts +5 -0
  46. package/core/metrics_manager.d.ts +5 -0
  47. package/core/options.d.ts +5 -0
  48. package/core/rendered_connection.d.ts +5 -0
  49. package/core/renderers/geras/geras.d.ts +5 -0
  50. package/core/renderers/minimalist/minimalist.d.ts +5 -0
  51. package/core/renderers/thrasos/thrasos.d.ts +5 -0
  52. package/core/renderers/zelos/zelos.d.ts +5 -0
  53. package/core/scrollbar.d.ts +5 -0
  54. package/core/serialization.d.ts +3 -0
  55. package/core/shortcut_registry.d.ts +6 -0
  56. package/core/theme_manager.d.ts +6 -0
  57. package/core/toolbox/collapsible_category.d.ts +5 -0
  58. package/core/toolbox/toolbox.d.ts +5 -0
  59. package/core/toolbox/toolbox_item.d.ts +5 -0
  60. package/core/trashcan.d.ts +5 -0
  61. package/core/utils/coordinate.d.ts +7 -0
  62. package/core/utils/rect.d.ts +7 -0
  63. package/core/utils/size.d.ts +7 -0
  64. package/core/utils/svg.d.ts +6 -0
  65. package/core/variable_map.d.ts +5 -0
  66. package/core/variable_model.d.ts +5 -0
  67. package/core/workspace.d.ts +9 -4
  68. package/core/workspace_comment_svg.d.ts +5 -0
  69. package/core/workspace_svg.d.ts +13 -2
  70. package/core/zoom_controls.d.ts +5 -0
  71. package/dart_compressed.js +88 -97
  72. package/dart_compressed.js.map +1 -1
  73. package/javascript_compressed.js +101 -112
  74. package/javascript_compressed.js.map +1 -1
  75. package/lua_compressed.js +75 -82
  76. package/lua_compressed.js.map +1 -1
  77. package/package.json +5 -6
  78. package/php_compressed.js +92 -100
  79. package/php_compressed.js.map +1 -1
  80. package/python_compressed.js +82 -92
  81. package/python_compressed.js.map +1 -1
  82. package/closure/goog/base.d.ts +0 -2
  83. package/closure/goog/base_minimal.d.ts +0 -19
  84. package/closure/goog/goog.d.ts +0 -26
package/core/block.d.ts CHANGED
@@ -3,6 +3,11 @@
3
3
  * Copyright 2011 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * The class representing one block.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import './events/events_block_create.js';
8
13
  import './events/events_block_delete.js';
@@ -436,6 +441,11 @@ export declare class Block implements IASTNodeLocation, IDeletable {
436
441
  * @returns True if this block has been disposed of / deleted.
437
442
  */
438
443
  isDisposed(): boolean;
444
+ /**
445
+ * @returns True if this block is a value block with a single editable field.
446
+ * @internal
447
+ */
448
+ isSimpleReporter(): boolean;
439
449
  /**
440
450
  * Find the connection on this block that corresponds to the given connection
441
451
  * on the other block.
@@ -3,6 +3,11 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Methods for dragging a block visually.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_drag.js';
7
12
  import type { BlockSvg } from './block_svg.js';
8
13
  import type { Icon } from './icons/icon.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Methods for graphically rendering a block as SVG.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_selected.js';
7
12
  import { Block } from './block.js';
8
13
  import { CommentIcon } from './icons/comment_icon.js';
@@ -426,9 +431,11 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
426
431
  * order that they are in the DOM. By placing this block first within the
427
432
  * block group's <g>, it will render on top of any other blocks.
428
433
  *
434
+ * @param blockOnly: True to only move this block to the front without
435
+ * adjusting its parents.
429
436
  * @internal
430
437
  */
431
- bringToFront(): void;
438
+ bringToFront(blockOnly?: boolean): void;
432
439
  /**
433
440
  * Set whether this block can chain onto the bottom of another block.
434
441
  *
@@ -565,11 +572,14 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
565
572
  * or an insertion marker.
566
573
  *
567
574
  * @param sourceConnection The connection on the moving block's stack.
568
- * @param targetConnection The connection that should stay stationary as this
569
- * block is positioned.
575
+ * @param originalOffsetToTarget The connection original offset to the target connection
576
+ * @param originalOffsetInBlock The connection original offset in its block
570
577
  * @internal
571
578
  */
572
- positionNearConnection(sourceConnection: RenderedConnection, targetConnection: RenderedConnection): void;
579
+ positionNearConnection(sourceConnection: RenderedConnection, originalOffsetToTarget: {
580
+ x: number;
581
+ y: number;
582
+ }, originalOffsetInBlock: Coordinate): void;
573
583
  /**
574
584
  * Find all the blocks that are directly nested inside this one.
575
585
  * Includes value and statement inputs, as well as any following statement.
@@ -3,6 +3,11 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Manager for all items registered with the workspace.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { IAutoHideable } from './interfaces/i_autohideable.js';
7
12
  import type { IComponent } from './interfaces/i_component.js';
8
13
  import type { IDeleteArea } from './interfaces/i_delete_area.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2011 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Components for creating connections between blocks.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from './block.js';
7
12
  import type { Input } from './inputs/input.js';
8
13
  import type { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
@@ -4,7 +4,9 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Block } from './block.js';
7
+ import type { BlockSvg } from './block_svg.js';
7
8
  import type { ContextMenuOption, LegacyContextMenuOption } from './contextmenu_registry.js';
9
+ import * as serializationBlocks from './serialization/blocks.js';
8
10
  import { WorkspaceCommentSvg } from './workspace_comment_svg.js';
9
11
  import type { WorkspaceSvg } from './workspace_svg.js';
10
12
  /**
@@ -37,13 +39,13 @@ export declare function hide(): void;
37
39
  export declare function dispose(): void;
38
40
  /**
39
41
  * Create a callback function that creates and configures a block,
40
- * then places the new block next to the original.
42
+ * then places the new block next to the original and returns it.
41
43
  *
42
44
  * @param block Original block.
43
- * @param xml XML representation of new block.
45
+ * @param state XML or JSON object representation of the new block.
44
46
  * @returns Function that creates a block.
45
47
  */
46
- export declare function callbackFactory(block: Block, xml: Element): () => void;
48
+ export declare function callbackFactory(block: Block, state: Element | serializationBlocks.State): () => BlockSvg;
47
49
  /**
48
50
  * Make a context menu option for deleting the current workspace comment.
49
51
  *
@@ -3,6 +3,11 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Registry for context menu option items.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { BlockSvg } from './block_svg.js';
7
12
  import type { WorkspaceSvg } from './workspace_svg.js';
8
13
  /**
@@ -74,7 +79,7 @@ export declare namespace ContextMenuRegistry {
74
79
  interface RegistryItem {
75
80
  callback: (p1: Scope) => void;
76
81
  scopeType: ScopeType;
77
- displayText: ((p1: Scope) => string) | string;
82
+ displayText: ((p1: Scope) => string | HTMLElement) | string | HTMLElement;
78
83
  preconditionFn: (p1: Scope) => string;
79
84
  weight: number;
80
85
  id: string;
@@ -83,7 +88,7 @@ export declare namespace ContextMenuRegistry {
83
88
  * A menu item as presented to contextmenu.js.
84
89
  */
85
90
  interface ContextMenuOption {
86
- text: string;
91
+ text: string | HTMLElement;
87
92
  enabled: boolean;
88
93
  callback: (p1: Scope) => void;
89
94
  scope: Scope;
@@ -3,6 +3,12 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * The abstract class for a component with custom behaviour when a
8
+ * block or bubble is dragged over or dropped on top of it.
9
+ *
10
+ * @class
11
+ */
6
12
  import type { IDragTarget } from './interfaces/i_drag_target.js';
7
13
  import type { IDraggable } from './interfaces/i_draggable.js';
8
14
  import type { Rect } from './utils/rect.js';
@@ -4,6 +4,11 @@
4
4
  * All rights reserved.
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
+ /**
8
+ * A div that floats on top of the workspace, for drop-down menus.
9
+ *
10
+ * @class
11
+ */
7
12
  import type { BlockSvg } from './block_svg.js';
8
13
  import type { Field } from './field.js';
9
14
  /**
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Base class for all types of block events.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import type { Workspace } from '../workspace.js';
8
13
  import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for a block change event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import type { BlockSvg } from '../block_svg.js';
8
13
  import { Workspace } from '../workspace.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for a block creation event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import * as blocks from '../serialization/blocks.js';
8
13
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for a block delete event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import * as blocks from '../serialization/blocks.js';
8
13
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Events fired as a block drag.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import { AbstractEventJson } from './events_abstract.js';
8
13
  import { UiBase } from './events_ui_base.js';
@@ -3,6 +3,12 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for an event representing an intermediate change to a block's field's
8
+ * value.
9
+ *
10
+ * @class
11
+ */
6
12
  import type { Block } from '../block.js';
7
13
  import { Workspace } from '../workspace.js';
8
14
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for a block move event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import { Coordinate } from '../utils/coordinate.js';
8
13
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Events fired as a result of bubble open.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { AbstractEventJson } from './events_abstract.js';
7
12
  import type { BlockSvg } from '../block_svg.js';
8
13
  import { UiBase } from './events_ui_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Events fired as a result of UI click in Blockly's editor.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import { AbstractEventJson } from './events_abstract.js';
8
13
  import { UiBase } from './events_ui_base.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Events fired as a result of a marker move.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { Block } from '../block.js';
7
12
  import { ASTNode } from '../keyboard_nav/ast_node.js';
8
13
  import type { Workspace } from '../workspace.js';
@@ -3,6 +3,12 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Base class for events fired as a result of UI actions in
8
+ * Blockly's editor.
9
+ *
10
+ * @class
11
+ */
6
12
  import { Abstract as AbstractEvent } from './events_abstract.js';
7
13
  /**
8
14
  * Base class for a UI event.
@@ -3,6 +3,11 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Abstract class for a variable event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { VariableModel } from '../variable_model.js';
7
12
  import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
8
13
  import type { Workspace } from '../workspace.js';
package/core/field.d.ts CHANGED
@@ -3,6 +3,13 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Field. Used for editable titles, variables, etc.
8
+ * This is an abstract class that defines the UI on the block. Actual
9
+ * instances would be FieldTextInput, FieldDropdown, etc.
10
+ *
11
+ * @class
12
+ */
6
13
  import './events/events_block_change.js';
7
14
  import type { Block } from './block.js';
8
15
  import type { Input } from './inputs/input.js';
@@ -44,9 +51,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
44
51
  * the prototype.
45
52
  *
46
53
  * Example:
47
- * ```typescript
48
- * FieldImage.prototype.DEFAULT_VALUE = null;
49
- * ```
54
+ * `FieldImage.prototype.DEFAULT_VALUE = null;`
50
55
  */
51
56
  DEFAULT_VALUE: T | null;
52
57
  /** Non-breaking space. */
@@ -195,6 +200,15 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
195
200
  * No-op by default.
196
201
  */
197
202
  initModel(): void;
203
+ /**
204
+ * Defines whether this field should take up the full block or not.
205
+ *
206
+ * Be cautious when overriding this function. It may not work as you expect /
207
+ * intend because the behavior was kind of hacked in. If you are thinking
208
+ * about overriding this function, post on the forum with your intended
209
+ * behavior to see if there's another approach.
210
+ */
211
+ protected isFullBlockField(): boolean;
198
212
  /**
199
213
  * Create a field border rect element. Not to be overridden by subclasses.
200
214
  * Instead modify the result of the function inside initView, or create a
@@ -3,6 +3,11 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Checkbox field. Checked or not checked.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import { Field, FieldConfig, FieldValidator } from './field.js';
8
13
  type BoolString = 'TRUE' | 'FALSE';
@@ -3,8 +3,14 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Colour input field.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import { Field, FieldConfig, FieldValidator } from './field.js';
13
+ import { Size } from './utils/size.js';
8
14
  /**
9
15
  * Class for a colour input field.
10
16
  */
@@ -86,10 +92,31 @@ export declare class FieldColour extends Field<string> {
86
92
  * Create the block UI for this colour field.
87
93
  */
88
94
  initView(): void;
95
+ protected isFullBlockField(): boolean;
89
96
  /**
90
97
  * Updates text field to match the colour/style of the block.
91
98
  */
92
99
  applyColour(): void;
100
+ /**
101
+ * Returns the height and width of the field.
102
+ *
103
+ * This should *in general* be the only place render_ gets called from.
104
+ *
105
+ * @returns Height and width.
106
+ */
107
+ getSize(): Size;
108
+ /**
109
+ * Updates the colour of the block to reflect whether this is a full
110
+ * block field or not.
111
+ */
112
+ protected render_(): void;
113
+ /**
114
+ * Updates the size of the field based on whether it is a full block field
115
+ * or not.
116
+ *
117
+ * @param margin margin to use when positioning the field.
118
+ */
119
+ protected updateSize_(margin?: number): void;
93
120
  /**
94
121
  * Ensure that the input value is a valid colour.
95
122
  *
@@ -97,13 +124,6 @@ export declare class FieldColour extends Field<string> {
97
124
  * @returns A valid colour, or null if invalid.
98
125
  */
99
126
  protected doClassValidation_(newValue?: any): string | null;
100
- /**
101
- * Update the value of this colour field, and update the displayed colour.
102
- *
103
- * @param newValue The value to be saved. The default validator guarantees
104
- * that this is a colour in '#rrggbb' format.
105
- */
106
- protected doValueUpdate_(newValue: string): void;
107
127
  /**
108
128
  * Get the text for this field. Used when the block is collapsed.
109
129
  *
@@ -3,6 +3,11 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Image field. Used for pictures, icons, etc.
8
+ *
9
+ * @class
10
+ */
6
11
  import { Field, FieldConfig } from './field.js';
7
12
  import { Size } from './utils/size.js';
8
13
  /**
@@ -3,9 +3,15 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Text input field.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import { Field, FieldConfig, FieldValidator } from './field.js';
8
13
  import type { WorkspaceSvg } from './workspace_svg.js';
14
+ import { Size } from './utils/size.js';
9
15
  /**
10
16
  * Supported types for FieldInput subclasses.
11
17
  *
@@ -48,7 +54,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
48
54
  * Whether the field should consider the whole parent block to be its click
49
55
  * target.
50
56
  */
51
- fullBlockClickTarget_: boolean | null;
57
+ fullBlockClickTarget_: boolean;
52
58
  /** The workspace that this field belongs to. */
53
59
  protected workspace_: WorkspaceSvg | null;
54
60
  /**
@@ -75,6 +81,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
75
81
  constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldInputValidator<T> | null, config?: FieldInputConfig);
76
82
  protected configure_(config: FieldInputConfig): void;
77
83
  initView(): void;
84
+ protected isFullBlockField(): boolean;
78
85
  /**
79
86
  * Called by setValue if the text input is not valid. If the field is
80
87
  * currently being edited it reverts value of the field to the previous
@@ -98,9 +105,20 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
98
105
  * Updates text field to match the colour/style of the block.
99
106
  */
100
107
  applyColour(): void;
108
+ /**
109
+ * Returns the height and width of the field.
110
+ *
111
+ * This should *in general* be the only place render_ gets called from.
112
+ *
113
+ * @returns Height and width.
114
+ */
115
+ getSize(): Size;
101
116
  /**
102
117
  * Updates the colour of the htmlInput given the current validity of the
103
118
  * field's value.
119
+ *
120
+ * Also updates the colour of the block to reflect whether this is a full
121
+ * block field or not.
104
122
  */
105
123
  protected render_(): void;
106
124
  /**
@@ -3,6 +3,13 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Non-editable, serializable text field. Behaves like a
8
+ * normal label but is serialized to XML. It may only be
9
+ * edited programmatically.
10
+ *
11
+ * @class
12
+ */
6
13
  import { FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig } from './field_label.js';
7
14
  /**
8
15
  * Class for a non-editable, serializable text field.
@@ -3,6 +3,11 @@
3
3
  * Copyright 2016 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Number input field
8
+ *
9
+ * @class
10
+ */
6
11
  import { Field } from './field.js';
7
12
  import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
8
13
  /**
@@ -3,6 +3,11 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Text input field.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import { Field } from './field.js';
8
13
  import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Variable input field.
8
+ *
9
+ * @class
10
+ */
6
11
  import './events/events_block_change.js';
7
12
  import type { Block } from './block.js';
8
13
  import { Field, FieldConfig } from './field.js';
@@ -3,6 +3,11 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Calculates and reports flyout workspace metrics.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { IFlyout } from './interfaces/i_flyout.js';
7
12
  import { ContainerRegion, MetricsManager } from './metrics_manager.js';
8
13
  import type { WorkspaceSvg } from './workspace_svg.js';
@@ -3,6 +3,12 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Utility functions for generating executable code from
8
+ * Blockly code.
9
+ *
10
+ * @class
11
+ */
6
12
  import type { Block } from './block.js';
7
13
  import { Names } from './names.js';
8
14
  import type { Workspace } from './workspace.js';
@@ -85,7 +91,7 @@ export declare class CodeGenerator {
85
91
  [key: string]: string;
86
92
  };
87
93
  /** A database of variable and procedure names. */
88
- protected nameDB_?: Names;
94
+ nameDB_?: Names;
89
95
  /** @param name Language name of this generator. */
90
96
  constructor(name: string);
91
97
  /**
@@ -192,6 +198,28 @@ export declare class CodeGenerator {
192
198
  * desiredName if the former has already been taken by the user.
193
199
  */
194
200
  provideFunction_(desiredName: string, code: string[] | string): string;
201
+ /**
202
+ * Gets a unique, legal name for a user-defined variable.
203
+ * Before calling this method, the `nameDB_` property of the class
204
+ * must have been initialized already. This is typically done in
205
+ * the `init` function of the code generator class.
206
+ *
207
+ * @param nameOrId The ID of the variable to get a name for,
208
+ * or the proposed name for a variable not associated with an id.
209
+ * @returns A unique, legal name for the variable.
210
+ */
211
+ getVariableName(nameOrId: string): string;
212
+ /**
213
+ * Gets a unique, legal name for a user-defined procedure.
214
+ * Before calling this method, the `nameDB_` property of the class
215
+ * must have been initialized already. This is typically done in
216
+ * the `init` function of the code generator class.
217
+ *
218
+ * @param name The proposed name for a procedure.
219
+ * @returns A unique, legal name for the procedure.
220
+ */
221
+ getProcedureName(name: string): string;
222
+ private getName;
195
223
  /**
196
224
  * Hook for code to run before code generation starts.
197
225
  * Subclasses may override this, e.g. to initialise the database of variable
package/core/gesture.d.ts CHANGED
@@ -3,6 +3,12 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * The class representing an in-progress gesture, e.g. a drag,
8
+ * tap, or pinch to zoom.
9
+ *
10
+ * @class
11
+ */
6
12
  import './events/events_click.js';
7
13
  import type { BlockSvg } from './block_svg.js';
8
14
  import { BubbleDragger } from './bubble_dragger.js';