blockly 10.2.0-beta.0 → 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.
- package/blockly.min.js +1726 -1899
- package/blockly_compressed.js +1463 -1614
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +162 -173
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +17 -1
- package/core/block_dragger.d.ts +5 -0
- package/core/block_svg.d.ts +14 -4
- package/core/component_manager.d.ts +5 -0
- package/core/connection.d.ts +5 -0
- package/core/contextmenu.d.ts +5 -3
- package/core/contextmenu_registry.d.ts +7 -2
- package/core/drag_target.d.ts +6 -0
- package/core/dropdowndiv.d.ts +5 -0
- package/core/events/events_block_base.d.ts +5 -0
- package/core/events/events_block_change.d.ts +5 -0
- package/core/events/events_block_create.d.ts +5 -0
- package/core/events/events_block_delete.d.ts +5 -0
- package/core/events/events_block_drag.d.ts +5 -0
- package/core/events/events_block_field_intermediate_change.d.ts +6 -0
- package/core/events/events_block_move.d.ts +5 -0
- package/core/events/events_bubble_open.d.ts +5 -0
- package/core/events/events_click.d.ts +5 -0
- package/core/events/events_marker_move.d.ts +5 -0
- package/core/events/events_ui_base.d.ts +6 -0
- package/core/events/events_var_base.d.ts +5 -0
- package/core/field.d.ts +20 -3
- package/core/field_checkbox.d.ts +5 -0
- package/core/field_colour.d.ts +27 -7
- package/core/field_image.d.ts +5 -0
- package/core/field_input.d.ts +19 -1
- package/core/field_label_serializable.d.ts +7 -0
- package/core/field_number.d.ts +5 -0
- package/core/field_textinput.d.ts +5 -0
- package/core/field_variable.d.ts +5 -0
- package/core/flyout_metrics_manager.d.ts +5 -0
- package/core/generator.d.ts +29 -1
- package/core/gesture.d.ts +6 -0
- package/core/icons/mutator_icon.d.ts +8 -0
- package/core/inputs/input.d.ts +5 -0
- package/core/keyboard_nav/ast_node.d.ts +6 -0
- package/core/keyboard_nav/marker.d.ts +6 -0
- package/core/main.d.ts +6 -4
- package/core/marker_manager.d.ts +5 -0
- package/core/menuitem.d.ts +5 -0
- package/core/metrics_manager.d.ts +5 -0
- package/core/options.d.ts +5 -0
- package/core/rendered_connection.d.ts +5 -0
- package/core/renderers/geras/geras.d.ts +5 -0
- package/core/renderers/minimalist/minimalist.d.ts +5 -0
- package/core/renderers/thrasos/thrasos.d.ts +5 -0
- package/core/renderers/zelos/zelos.d.ts +5 -0
- package/core/scrollbar.d.ts +5 -0
- package/core/serialization.d.ts +3 -0
- package/core/shortcut_registry.d.ts +6 -0
- package/core/theme_manager.d.ts +6 -0
- package/core/toolbox/collapsible_category.d.ts +5 -0
- package/core/toolbox/toolbox.d.ts +5 -0
- package/core/toolbox/toolbox_item.d.ts +5 -0
- package/core/trashcan.d.ts +5 -0
- package/core/utils/coordinate.d.ts +7 -0
- package/core/utils/rect.d.ts +7 -0
- package/core/utils/size.d.ts +7 -0
- package/core/utils/svg.d.ts +6 -0
- package/core/variable_map.d.ts +5 -0
- package/core/variable_model.d.ts +5 -0
- package/core/workspace.d.ts +9 -4
- package/core/workspace_comment_svg.d.ts +5 -0
- package/core/workspace_svg.d.ts +15 -2
- package/core/zoom_controls.d.ts +5 -0
- package/dart_compressed.js +88 -97
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +101 -112
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +75 -82
- package/lua_compressed.js.map +1 -1
- package/package.json +6 -7
- package/php_compressed.js +92 -100
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +82 -92
- package/python_compressed.js.map +1 -1
- package/closure/goog/base.d.ts +0 -2
- package/closure/goog/base_minimal.d.ts +0 -19
- 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';
|
|
@@ -76,8 +81,14 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
76
81
|
* An optional serialization method for defining how to serialize the
|
|
77
82
|
* block's extra state (eg mutation state) to something JSON compatible.
|
|
78
83
|
* This must be coupled with defining `loadExtraState`.
|
|
84
|
+
*
|
|
85
|
+
* @param doFullSerialization Whether or not to serialize the full state of
|
|
86
|
+
* the extra state (rather than possibly saving a reference to some
|
|
87
|
+
* state). This is used during copy-paste. See the
|
|
88
|
+
* {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/extensions#full_serialization_and_backing_data | block serialization docs}
|
|
89
|
+
* for more information.
|
|
79
90
|
*/
|
|
80
|
-
saveExtraState?: () => any;
|
|
91
|
+
saveExtraState?: (doFullSerialization?: boolean) => any;
|
|
81
92
|
/**
|
|
82
93
|
* An optional serialization method for defining how to deserialize the
|
|
83
94
|
* block's extra state (eg mutation state) from something JSON compatible.
|
|
@@ -430,6 +441,11 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
430
441
|
* @returns True if this block has been disposed of / deleted.
|
|
431
442
|
*/
|
|
432
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;
|
|
433
449
|
/**
|
|
434
450
|
* Find the connection on this block that corresponds to the given connection
|
|
435
451
|
* on the other block.
|
package/core/block_dragger.d.ts
CHANGED
|
@@ -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';
|
package/core/block_svg.d.ts
CHANGED
|
@@ -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
|
|
569
|
-
*
|
|
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,
|
|
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';
|
package/core/connection.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
|
+
* 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';
|
package/core/contextmenu.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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;
|
package/core/drag_target.d.ts
CHANGED
|
@@ -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';
|
package/core/dropdowndiv.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
|
@@ -236,6 +250,9 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
236
250
|
* @param _doFullSerialization If true, this signals to the field that if it
|
|
237
251
|
* normally just saves a reference to some state (eg variable fields) it
|
|
238
252
|
* should instead serialize the full state of the thing being referenced.
|
|
253
|
+
* See the
|
|
254
|
+
* {@link https://developers.devsite.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating#full_serialization_and_backing_data | field serialization docs}
|
|
255
|
+
* for more information.
|
|
239
256
|
* @returns JSON serializable state.
|
|
240
257
|
* @internal
|
|
241
258
|
*/
|
package/core/field_checkbox.d.ts
CHANGED
|
@@ -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';
|
package/core/field_colour.d.ts
CHANGED
|
@@ -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
|
*
|
package/core/field_image.d.ts
CHANGED
package/core/field_input.d.ts
CHANGED
|
@@ -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
|
|
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.
|
package/core/field_number.d.ts
CHANGED
|
@@ -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';
|
package/core/field_variable.d.ts
CHANGED
|
@@ -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';
|