blockly 11.0.0-beta.5 → 11.0.0-beta.7
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 +722 -763
- package/blockly_compressed.js +676 -680
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +27 -29
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +12 -6
- package/core/block_svg.d.ts +28 -42
- package/core/blockly.d.ts +11 -51
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
- package/core/bubbles/text_bubble.d.ts +1 -1
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/clipboard.d.ts +0 -19
- package/core/comments/comment_view.d.ts +207 -0
- package/core/comments/rendered_workspace_comment.d.ts +75 -0
- package/core/comments/workspace_comment.d.ts +107 -0
- package/core/comments.d.ts +9 -0
- package/core/connection.d.ts +1 -1
- package/core/delete_area.d.ts +1 -2
- package/core/dragging/block_drag_strategy.d.ts +105 -0
- package/core/dragging/bubble_drag_strategy.d.ts +20 -0
- package/core/dragging/comment_drag_strategy.d.ts +20 -0
- package/core/dragging/dragger.d.ts +47 -0
- package/core/events/events.d.ts +3 -0
- package/core/events/events_click.d.ts +1 -1
- package/core/events/events_comment_base.d.ts +6 -1
- package/core/events/events_comment_change.d.ts +1 -1
- package/core/events/events_comment_collapse.d.ts +39 -0
- package/core/events/events_comment_create.d.ts +5 -1
- package/core/events/events_comment_delete.d.ts +5 -1
- package/core/events/events_comment_move.d.ts +17 -1
- package/core/events/utils.d.ts +2 -0
- package/core/field_dropdown.d.ts +1 -0
- package/core/field_image.d.ts +1 -1
- package/core/flyout_base.d.ts +17 -1
- package/core/flyout_button.d.ts +26 -1
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +25 -54
- package/core/grid.d.ts +9 -9
- package/core/icons/comment_icon.d.ts +8 -3
- package/core/icons/icon.d.ts +0 -6
- package/core/icons/icon_types.d.ts +2 -2
- package/core/icons/mutator_icon.d.ts +1 -16
- package/core/icons/warning_icon.d.ts +1 -1
- package/core/inputs/input.d.ts +10 -19
- package/core/{connection_previewers/insertion_marker_previewer.d.ts → insertion_marker_previewer.d.ts} +3 -3
- package/core/interfaces/i_comment_icon.d.ts +21 -0
- package/core/interfaces/i_deletable.d.ts +6 -0
- package/core/interfaces/i_delete_area.d.ts +1 -2
- package/core/interfaces/i_draggable.d.ts +47 -3
- package/core/interfaces/i_dragger.d.ts +32 -0
- package/core/interfaces/i_has_bubble.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +7 -0
- package/core/interfaces/i_procedure_model.d.ts +7 -0
- package/core/interfaces/i_selectable.d.ts +5 -3
- package/core/internal_constants.d.ts +0 -7
- package/core/keyboard_nav/ast_node.d.ts +21 -2
- package/core/options.d.ts +1 -0
- package/core/registry.d.ts +2 -2
- package/core/renderers/common/drawer.d.ts +0 -7
- package/core/renderers/common/marker_svg.d.ts +7 -0
- package/core/renderers/measurables/icon.d.ts +0 -5
- package/core/serialization/priorities.d.ts +2 -0
- package/core/serialization/procedures.d.ts +28 -26
- package/core/serialization/workspace_comments.d.ts +45 -0
- package/core/serialization.d.ts +2 -1
- package/core/toolbox/toolbox.d.ts +1 -2
- package/core/utils/dom.d.ts +0 -9
- package/core/utils/keycodes.d.ts +32 -32
- package/core/utils/size.d.ts +10 -0
- package/core/utils/string.d.ts +0 -10
- package/core/workspace_comment_svg.d.ts +1 -2
- package/core/workspace_svg.d.ts +0 -27
- package/core/xml.d.ts +9 -3
- package/core-node.js +31 -0
- package/dart.d.ts +1 -24
- package/dart_compressed.js +22 -72
- package/dart_compressed.js.map +1 -1
- package/generators/dart/dart_generator.d.ts +17 -17
- package/generators/dart/text.d.ts +0 -1
- package/generators/javascript/javascript_generator.d.ts +34 -35
- package/generators/javascript/text.d.ts +0 -1
- package/generators/lua/lua_generator.d.ts +10 -10
- package/generators/lua/text.d.ts +0 -1
- package/generators/php/php_generator.d.ts +36 -36
- package/generators/php/text.d.ts +0 -1
- package/generators/python/python_generator.d.ts +20 -21
- package/generators/python/text.d.ts +0 -1
- package/index.js +19 -7
- package/javascript.d.ts +1 -41
- package/javascript_compressed.js +19 -54
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +1 -18
- package/lua_compressed.js +24 -47
- package/lua_compressed.js.map +1 -1
- package/media/delete-icon.svg +1 -0
- package/media/foldout-icon.svg +1 -0
- package/media/resize-handle.svg +3 -0
- package/msg/ce.d.ts +8 -0
- package/msg/dtp.d.ts +8 -0
- package/msg/hsb.d.ts +8 -0
- package/msg/tdd.d.ts +8 -0
- package/package.json +46 -12
- package/php.d.ts +1 -43
- package/php_compressed.js +13 -46
- package/php_compressed.js.map +1 -1
- package/python.d.ts +1 -27
- package/python_compressed.js +21 -40
- package/python_compressed.js.map +1 -1
- package/blockly.js +0 -22
- package/blocks.js +0 -22
- package/browser.js +0 -30
- package/core/block_dragger.d.ts +0 -212
- package/core/bubble_dragger.d.ts +0 -77
- package/core/field_angle.d.ts +0 -208
- package/core/field_colour.d.ts +0 -243
- package/core/field_multilineinput.d.ts +0 -182
- package/core/interfaces/i_block_dragger.d.ts +0 -47
- package/core/renderers/minimalist/constants.d.ts +0 -21
- package/core/renderers/minimalist/drawer.d.ts +0 -26
- package/core/renderers/minimalist/info.d.ts +0 -35
- package/core/renderers/minimalist/minimalist.d.ts +0 -12
- package/core/renderers/minimalist/renderer.d.ts +0 -48
- package/core-browser.js +0 -26
- package/core.js +0 -26
- package/dart.js +0 -22
- package/generators/dart/colour.d.ts +0 -16
- package/generators/javascript/colour.d.ts +0 -16
- package/generators/lua/colour.d.ts +0 -16
- package/generators/php/colour.d.ts +0 -16
- package/generators/python/colour.d.ts +0 -16
- package/javascript.js +0 -23
- package/lua.js +0 -22
- package/msg/constants.d.ts +0 -14
- package/msg/qqq.d.ts +0 -14
- package/msg/synonyms.d.ts +0 -14
- package/node.js +0 -21
- package/php.js +0 -22
- package/python.js +0 -23
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
|
+
import type { Workspace } from '../workspace.js';
|
|
9
|
+
export declare class CommentCollapse extends CommentBase {
|
|
10
|
+
newCollapsed?: boolean | undefined;
|
|
11
|
+
type: string;
|
|
12
|
+
constructor(comment?: WorkspaceComment, newCollapsed?: boolean | undefined);
|
|
13
|
+
/**
|
|
14
|
+
* Encode the event as JSON.
|
|
15
|
+
*
|
|
16
|
+
* @returns JSON representation.
|
|
17
|
+
*/
|
|
18
|
+
toJson(): CommentCollapseJson;
|
|
19
|
+
/**
|
|
20
|
+
* Deserializes the JSON event.
|
|
21
|
+
*
|
|
22
|
+
* @param event The event to append new properties to. Should be a subclass
|
|
23
|
+
* of CommentCollapse, but we can't specify that due to the fact that
|
|
24
|
+
* parameters to static methods in subclasses must be supertypes of
|
|
25
|
+
* parameters to static methods in superclasses.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
static fromJson(json: CommentCollapseJson, workspace: Workspace, event?: any): CommentCollapse;
|
|
29
|
+
/**
|
|
30
|
+
* Run a collapse event.
|
|
31
|
+
*
|
|
32
|
+
* @param forward True if run forward, false if run backward (undo).
|
|
33
|
+
*/
|
|
34
|
+
run(forward: boolean): void;
|
|
35
|
+
}
|
|
36
|
+
export interface CommentCollapseJson extends CommentBaseJson {
|
|
37
|
+
newCollapsed: boolean;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=events_comment_collapse.d.ts.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import * as comments from '../serialization/workspace_comments.js';
|
|
7
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
9
|
import type { Workspace } from '../workspace.js';
|
|
9
10
|
/**
|
|
@@ -13,6 +14,8 @@ export declare class CommentCreate extends CommentBase {
|
|
|
13
14
|
type: string;
|
|
14
15
|
/** The XML representation of the created workspace comment. */
|
|
15
16
|
xml?: Element | DocumentFragment;
|
|
17
|
+
/** The JSON representation of the created workspace comment. */
|
|
18
|
+
json?: comments.State;
|
|
16
19
|
/**
|
|
17
20
|
* @param opt_comment The created comment.
|
|
18
21
|
* Undefined for a blank event.
|
|
@@ -43,5 +46,6 @@ export declare class CommentCreate extends CommentBase {
|
|
|
43
46
|
}
|
|
44
47
|
export interface CommentCreateJson extends CommentBaseJson {
|
|
45
48
|
xml: string;
|
|
49
|
+
json: object;
|
|
46
50
|
}
|
|
47
51
|
//# sourceMappingURL=events_comment_create.d.ts.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import * as comments from '../serialization/workspace_comments.js';
|
|
7
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
9
|
import type { Workspace } from '../workspace.js';
|
|
9
10
|
/**
|
|
@@ -13,6 +14,8 @@ export declare class CommentDelete extends CommentBase {
|
|
|
13
14
|
type: string;
|
|
14
15
|
/** The XML representation of the deleted workspace comment. */
|
|
15
16
|
xml?: Element;
|
|
17
|
+
/** The JSON representation of the created workspace comment. */
|
|
18
|
+
json?: comments.State;
|
|
16
19
|
/**
|
|
17
20
|
* @param opt_comment The deleted comment.
|
|
18
21
|
* Undefined for a blank event.
|
|
@@ -43,5 +46,6 @@ export declare class CommentDelete extends CommentBase {
|
|
|
43
46
|
}
|
|
44
47
|
export interface CommentDeleteJson extends CommentBaseJson {
|
|
45
48
|
xml: string;
|
|
49
|
+
json: object;
|
|
46
50
|
}
|
|
47
51
|
//# sourceMappingURL=events_comment_delete.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Coordinate } from '../utils/coordinate.js';
|
|
7
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
7
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
8
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
9
9
|
import type { Workspace } from '../workspace.js';
|
|
10
10
|
/**
|
|
@@ -18,6 +18,16 @@ export declare class CommentMove extends CommentBase {
|
|
|
18
18
|
oldCoordinate_?: Coordinate;
|
|
19
19
|
/** The location of the comment after the move, in workspace coordinates. */
|
|
20
20
|
newCoordinate_?: Coordinate;
|
|
21
|
+
/**
|
|
22
|
+
* An explanation of what this move is for. Known values include:
|
|
23
|
+
* 'drag' -- A drag operation completed.
|
|
24
|
+
* 'snap' -- Comment got shifted to line up with the grid.
|
|
25
|
+
* 'inbounds' -- Block got pushed back into a non-scrolling workspace.
|
|
26
|
+
* 'create' -- Block created via deserialization.
|
|
27
|
+
* 'cleanup' -- Workspace aligned top-level blocks.
|
|
28
|
+
* Event merging may create multiple reasons: ['drag', 'inbounds', 'snap'].
|
|
29
|
+
*/
|
|
30
|
+
reason?: string[];
|
|
21
31
|
/**
|
|
22
32
|
* @param opt_comment The comment that is being moved. Undefined for a blank
|
|
23
33
|
* event.
|
|
@@ -28,6 +38,12 @@ export declare class CommentMove extends CommentBase {
|
|
|
28
38
|
* called once.
|
|
29
39
|
*/
|
|
30
40
|
recordNew(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the reason for a move event.
|
|
43
|
+
*
|
|
44
|
+
* @param reason Why is this move happening? 'drag', 'bump', 'snap', ...
|
|
45
|
+
*/
|
|
46
|
+
setReason(reason: string[]): void;
|
|
31
47
|
/**
|
|
32
48
|
* Override the location before the move. Use this if you don't create the
|
|
33
49
|
* event until the end of the move, but you know the original location.
|
package/core/events/utils.d.ts
CHANGED
|
@@ -127,6 +127,8 @@ export declare const COMMENT_CHANGE = "comment_change";
|
|
|
127
127
|
* Name of event that moves a comment.
|
|
128
128
|
*/
|
|
129
129
|
export declare const COMMENT_MOVE = "comment_move";
|
|
130
|
+
/** Type of event that moves a comment. */
|
|
131
|
+
export declare const COMMENT_COLLAPSE = "comment_collapse";
|
|
130
132
|
/**
|
|
131
133
|
* Name of event that records a workspace load.
|
|
132
134
|
*/
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
148
148
|
* @param newValue The input value.
|
|
149
149
|
* @returns A valid language-neutral option, or null if invalid.
|
|
150
150
|
*/
|
|
151
|
+
protected doClassValidation_(newValue: string): string | null | undefined;
|
|
151
152
|
protected doClassValidation_(newValue?: string): string | null;
|
|
152
153
|
/**
|
|
153
154
|
* Update the value of this dropdown field.
|
package/core/field_image.d.ts
CHANGED
|
@@ -134,7 +134,7 @@ export interface FieldImageConfig extends FieldConfig {
|
|
|
134
134
|
alt?: string;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* fromJson config options for the
|
|
137
|
+
* fromJson config options for the image field.
|
|
138
138
|
*/
|
|
139
139
|
export interface FieldImageFromJsonConfig extends FieldImageConfig {
|
|
140
140
|
src?: string;
|
package/core/flyout_base.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2011 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { BlockSvg } from './block_svg.js';
|
|
7
7
|
import { DeleteArea } from './delete_area.js';
|
|
8
8
|
import { FlyoutButton } from './flyout_button.js';
|
|
9
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
@@ -119,6 +119,10 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
119
119
|
* List of visible buttons.
|
|
120
120
|
*/
|
|
121
121
|
protected buttons_: FlyoutButton[];
|
|
122
|
+
/**
|
|
123
|
+
* List of visible buttons and blocks.
|
|
124
|
+
*/
|
|
125
|
+
protected contents: FlyoutItem[];
|
|
122
126
|
/**
|
|
123
127
|
* List of event listeners.
|
|
124
128
|
*/
|
|
@@ -279,6 +283,18 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
279
283
|
* @param visible Whether the container is visible.
|
|
280
284
|
*/
|
|
281
285
|
setContainerVisible(visible: boolean): void;
|
|
286
|
+
/**
|
|
287
|
+
* Get the list of buttons and blocks of the current flyout.
|
|
288
|
+
*
|
|
289
|
+
* @returns The array of flyout buttons and blocks.
|
|
290
|
+
*/
|
|
291
|
+
getContents(): FlyoutItem[];
|
|
292
|
+
/**
|
|
293
|
+
* Store the list of buttons and blocks on the flyout.
|
|
294
|
+
*
|
|
295
|
+
* @param contents - The array of items for the flyout.
|
|
296
|
+
*/
|
|
297
|
+
setContents(contents: FlyoutItem[]): void;
|
|
282
298
|
/**
|
|
283
299
|
* Update the display property of the flyout based whether it thinks it should
|
|
284
300
|
* be visible and whether its containing workspace is visible.
|
package/core/flyout_button.d.ts
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
import { Coordinate } from './utils/coordinate.js';
|
|
7
7
|
import type * as toolbox from './utils/toolbox.js';
|
|
8
8
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
9
|
+
import type { IASTNodeLocationSvg } from './blockly.js';
|
|
9
10
|
/**
|
|
10
11
|
* Class for a button or label in the flyout.
|
|
11
12
|
*/
|
|
12
|
-
export declare class FlyoutButton {
|
|
13
|
+
export declare class FlyoutButton implements IASTNodeLocationSvg {
|
|
13
14
|
private readonly workspace;
|
|
14
15
|
private readonly targetWorkspace;
|
|
15
16
|
private readonly isLabel_;
|
|
@@ -34,6 +35,11 @@ export declare class FlyoutButton {
|
|
|
34
35
|
private svgGroup;
|
|
35
36
|
/** The SVG element with the text of the label or button. */
|
|
36
37
|
private svgText;
|
|
38
|
+
/**
|
|
39
|
+
* Holds the cursors svg element when the cursor is attached to the button.
|
|
40
|
+
* This is null if there is no cursor on the button.
|
|
41
|
+
*/
|
|
42
|
+
cursorSvg: SVGElement | null;
|
|
37
43
|
/**
|
|
38
44
|
* @param workspace The workspace in which to place this button.
|
|
39
45
|
* @param targetWorkspace The flyout's target workspace.
|
|
@@ -76,8 +82,27 @@ export declare class FlyoutButton {
|
|
|
76
82
|
* @returns The target workspace of the flyout where this button resides.
|
|
77
83
|
*/
|
|
78
84
|
getTargetWorkspace(): WorkspaceSvg;
|
|
85
|
+
/**
|
|
86
|
+
* Get the button's workspace.
|
|
87
|
+
*
|
|
88
|
+
* @returns The workspace in which to place this button.
|
|
89
|
+
*/
|
|
90
|
+
getWorkspace(): WorkspaceSvg;
|
|
79
91
|
/** Dispose of this button. */
|
|
80
92
|
dispose(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Add the cursor SVG to this buttons's SVG group.
|
|
95
|
+
*
|
|
96
|
+
* @param cursorSvg The SVG root of the cursor to be added to the button SVG
|
|
97
|
+
* group.
|
|
98
|
+
*/
|
|
99
|
+
setCursorSvg(cursorSvg: SVGElement): void;
|
|
100
|
+
/**
|
|
101
|
+
* Required by IASTNodeLocationSvg, but not used. A marker cannot be set on a
|
|
102
|
+
* button. If the 'mark' shortcut is used on a button, its associated callback
|
|
103
|
+
* function is triggered.
|
|
104
|
+
*/
|
|
105
|
+
setMarkerSvg(): void;
|
|
81
106
|
/**
|
|
82
107
|
* Do something when the button is clicked.
|
|
83
108
|
*
|
package/core/generator.d.ts
CHANGED
|
@@ -254,7 +254,7 @@ export declare class CodeGenerator {
|
|
|
254
254
|
* @param _opt_thisOnly True to generate code for only this statement.
|
|
255
255
|
* @returns Code with comments and subsequent blocks added.
|
|
256
256
|
*/
|
|
257
|
-
|
|
257
|
+
scrub_(_block: Block, code: string, _opt_thisOnly?: boolean): string;
|
|
258
258
|
/**
|
|
259
259
|
* Hook for code to run at end of code generation.
|
|
260
260
|
* Subclasses may override this, e.g. to prepend the generated code with
|
package/core/gesture.d.ts
CHANGED
|
@@ -11,15 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import './events/events_click.js';
|
|
13
13
|
import type { BlockSvg } from './block_svg.js';
|
|
14
|
-
import { BubbleDragger } from './bubble_dragger.js';
|
|
15
14
|
import type { Field } from './field.js';
|
|
16
|
-
import type { IBlockDragger } from './interfaces/i_block_dragger.js';
|
|
17
15
|
import type { IBubble } from './interfaces/i_bubble.js';
|
|
18
16
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
19
17
|
import { Coordinate } from './utils/coordinate.js';
|
|
20
|
-
import { WorkspaceDragger } from './workspace_dragger.js';
|
|
21
18
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
22
19
|
import type { IIcon } from './interfaces/i_icon.js';
|
|
20
|
+
import { RenderedWorkspaceComment } from './comments.js';
|
|
23
21
|
/**
|
|
24
22
|
* Class for one gesture.
|
|
25
23
|
*/
|
|
@@ -52,6 +50,11 @@ export declare class Gesture {
|
|
|
52
50
|
* block.
|
|
53
51
|
*/
|
|
54
52
|
private startBlock;
|
|
53
|
+
/**
|
|
54
|
+
* The comment that the gesture started on, or null if it did not start on a
|
|
55
|
+
* comment.
|
|
56
|
+
*/
|
|
57
|
+
private startComment;
|
|
55
58
|
/**
|
|
56
59
|
* The block that this gesture targets. If the gesture started on a
|
|
57
60
|
* shadow block, this is the first non-shadow parent of the block. If the
|
|
@@ -77,15 +80,14 @@ export declare class Gesture {
|
|
|
77
80
|
* Ex: [[node, name, func], [node, name, func]].
|
|
78
81
|
*/
|
|
79
82
|
private boundEvents;
|
|
80
|
-
|
|
81
|
-
private bubbleDragger;
|
|
82
|
-
/** The object tracking a block drag, or null if none is in progress. */
|
|
83
|
-
private blockDragger;
|
|
83
|
+
private dragger;
|
|
84
84
|
/**
|
|
85
85
|
* The object tracking a workspace or flyout workspace drag, or null if none
|
|
86
86
|
* is in progress.
|
|
87
87
|
*/
|
|
88
88
|
private workspaceDragger;
|
|
89
|
+
/** Whether the gesture is dragging or not. */
|
|
90
|
+
private dragging;
|
|
89
91
|
/** The flyout a gesture started in, if any. */
|
|
90
92
|
private flyout;
|
|
91
93
|
/** Boolean for sanity-checking that some code is only called once. */
|
|
@@ -94,7 +96,6 @@ export declare class Gesture {
|
|
|
94
96
|
private gestureHasStarted;
|
|
95
97
|
/** Boolean used internally to break a cycle in disposal. */
|
|
96
98
|
protected isEnding_: boolean;
|
|
97
|
-
private healStack;
|
|
98
99
|
/** The event that most recently updated this gesture. */
|
|
99
100
|
private mostRecentEvent;
|
|
100
101
|
/** Boolean for whether or not this gesture is a multi-touch gesture. */
|
|
@@ -158,30 +159,6 @@ export declare class Gesture {
|
|
|
158
159
|
* @returns True if a block is being dragged from the flyout.
|
|
159
160
|
*/
|
|
160
161
|
private updateIsDraggingFromFlyout;
|
|
161
|
-
/**
|
|
162
|
-
* Update this gesture to record whether a bubble is being dragged.
|
|
163
|
-
* This function should be called on a pointermove event the first time
|
|
164
|
-
* the drag radius is exceeded. It should be called no more than once per
|
|
165
|
-
* gesture. If a bubble should be dragged this function creates the necessary
|
|
166
|
-
* BubbleDragger and starts the drag.
|
|
167
|
-
*
|
|
168
|
-
* @returns True if a bubble is being dragged.
|
|
169
|
-
*/
|
|
170
|
-
private updateIsDraggingBubble;
|
|
171
|
-
/**
|
|
172
|
-
* Check whether to start a block drag. If a block should be dragged, either
|
|
173
|
-
* from the flyout or in the workspace, create the necessary BlockDragger and
|
|
174
|
-
* start the drag.
|
|
175
|
-
*
|
|
176
|
-
* This function should be called on a pointermove event the first time
|
|
177
|
-
* the drag radius is exceeded. It should be called no more than once per
|
|
178
|
-
* gesture. If a block should be dragged, either from the flyout or in the
|
|
179
|
-
* workspace, this function creates the necessary BlockDragger and starts the
|
|
180
|
-
* drag.
|
|
181
|
-
*
|
|
182
|
-
* @returns True if a block is being dragged.
|
|
183
|
-
*/
|
|
184
|
-
private updateIsDraggingBlock;
|
|
185
162
|
/**
|
|
186
163
|
* Check whether to start a workspace drag. If a workspace is being dragged,
|
|
187
164
|
* create the necessary WorkspaceDragger and start the drag.
|
|
@@ -199,10 +176,7 @@ export declare class Gesture {
|
|
|
199
176
|
* gesture.
|
|
200
177
|
*/
|
|
201
178
|
private updateIsDragging;
|
|
202
|
-
|
|
203
|
-
private startDraggingBlock;
|
|
204
|
-
/** Create a bubble dragger and start dragging the selected bubble. */
|
|
205
|
-
private startDraggingBubble;
|
|
179
|
+
private createDragger;
|
|
206
180
|
/**
|
|
207
181
|
* Start a gesture: update the workspace to indicate that a gesture is in
|
|
208
182
|
* progress and bind pointermove and pointerup handlers.
|
|
@@ -335,8 +309,14 @@ export declare class Gesture {
|
|
|
335
309
|
* @internal
|
|
336
310
|
*/
|
|
337
311
|
handleBubbleStart(e: PointerEvent, bubble: IBubble): void;
|
|
338
|
-
/**
|
|
339
|
-
|
|
312
|
+
/**
|
|
313
|
+
* Handle a pointerdown event on a workspace comment.
|
|
314
|
+
*
|
|
315
|
+
* @param e A pointerdown event.
|
|
316
|
+
* @param comment The comment the event hit.
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
handleCommentStart(e: PointerEvent, comment: RenderedWorkspaceComment): void;
|
|
340
320
|
/** Execute a field click. */
|
|
341
321
|
private doFieldClick;
|
|
342
322
|
/** Execute an icon click. */
|
|
@@ -376,6 +356,13 @@ export declare class Gesture {
|
|
|
376
356
|
* @internal
|
|
377
357
|
*/
|
|
378
358
|
setStartBubble(bubble: IBubble): void;
|
|
359
|
+
/**
|
|
360
|
+
* Record the comment that a gesture started on
|
|
361
|
+
*
|
|
362
|
+
* @param comment The comment the gesture started on.
|
|
363
|
+
* @internal
|
|
364
|
+
*/
|
|
365
|
+
setStartComment(comment: RenderedWorkspaceComment): void;
|
|
379
366
|
/**
|
|
380
367
|
* Record the block that a gesture started on, and set the target block
|
|
381
368
|
* appropriately.
|
|
@@ -452,22 +439,6 @@ export declare class Gesture {
|
|
|
452
439
|
* @internal
|
|
453
440
|
*/
|
|
454
441
|
hasStarted(): boolean;
|
|
455
|
-
/**
|
|
456
|
-
* Get a list of the insertion markers that currently exist. Block drags have
|
|
457
|
-
* 0, 1, or 2 insertion markers.
|
|
458
|
-
*
|
|
459
|
-
* @returns A possibly empty list of insertion marker blocks.
|
|
460
|
-
* @internal
|
|
461
|
-
*/
|
|
462
|
-
getInsertionMarkers(): BlockSvg[];
|
|
463
|
-
/**
|
|
464
|
-
* Gets the current dragger if an item is being dragged. Null if nothing is
|
|
465
|
-
* being dragged.
|
|
466
|
-
*
|
|
467
|
-
* @returns The dragger that is currently in use or null if no drag is in
|
|
468
|
-
* progress.
|
|
469
|
-
*/
|
|
470
|
-
getCurrentDragger(): WorkspaceDragger | BubbleDragger | IBlockDragger | null;
|
|
471
442
|
/**
|
|
472
443
|
* Is a drag or other gesture currently in progress on any workspace?
|
|
473
444
|
*
|
package/core/grid.d.ts
CHANGED
|
@@ -31,8 +31,16 @@ export declare class Grid {
|
|
|
31
31
|
* dropped it will snap to the grid if snapping to the grid is enabled.
|
|
32
32
|
*/
|
|
33
33
|
setSpacing(spacing: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get the spacing of the grid points (in px).
|
|
36
|
+
*
|
|
37
|
+
* @returns The spacing of the grid points.
|
|
38
|
+
*/
|
|
39
|
+
getSpacing(): number;
|
|
34
40
|
/** Sets the length of the grid lines. */
|
|
35
41
|
setLength(length: number): void;
|
|
42
|
+
/** Get the length of the grid lines (in px). */
|
|
43
|
+
getLength(): number;
|
|
36
44
|
/**
|
|
37
45
|
* Sets whether blocks should snap to the grid or not.
|
|
38
46
|
*
|
|
@@ -43,19 +51,11 @@ export declare class Grid {
|
|
|
43
51
|
*/
|
|
44
52
|
setSnapToGrid(snap: boolean): void;
|
|
45
53
|
/**
|
|
46
|
-
* Whether blocks should snap to the grid
|
|
54
|
+
* Whether blocks should snap to the grid.
|
|
47
55
|
*
|
|
48
56
|
* @returns True if blocks should snap, false otherwise.
|
|
49
|
-
* @internal
|
|
50
57
|
*/
|
|
51
58
|
shouldSnap(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get the spacing of the grid points (in px).
|
|
54
|
-
*
|
|
55
|
-
* @returns The spacing of the grid points.
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
getSpacing(): number;
|
|
59
59
|
/**
|
|
60
60
|
* Get the ID of the pattern element, which should be randomized to avoid
|
|
61
61
|
* conflicts with other Blockly instances on the page.
|
|
@@ -16,7 +16,7 @@ import { Size } from '../utils/size.js';
|
|
|
16
16
|
export declare class CommentIcon extends Icon implements IHasBubble, ISerializable {
|
|
17
17
|
protected readonly sourceBlock: Block;
|
|
18
18
|
/** The type string used to identify this icon. */
|
|
19
|
-
static readonly TYPE: IconType<
|
|
19
|
+
static readonly TYPE: IconType<import("../interfaces/i_comment_icon.js").ICommentIcon>;
|
|
20
20
|
/**
|
|
21
21
|
* The weight this icon has relative to other icons. Icons with more positive
|
|
22
22
|
* weight values are rendered farther toward the end of the block.
|
|
@@ -49,7 +49,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
49
49
|
* Updates the state of the bubble (editable / noneditable) to reflect the
|
|
50
50
|
* state of the bubble if the bubble is currently shown.
|
|
51
51
|
*/
|
|
52
|
-
updateEditable(): void
|
|
52
|
+
updateEditable(): Promise<void>;
|
|
53
53
|
onLocationChange(blockOrigin: Coordinate): void;
|
|
54
54
|
/** Sets the text of this comment. Updates any bubbles if they are visible. */
|
|
55
55
|
setText(text: string): void;
|
|
@@ -82,7 +82,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
82
82
|
*/
|
|
83
83
|
onSizeChange(): void;
|
|
84
84
|
bubbleIsVisible(): boolean;
|
|
85
|
-
setBubbleVisible(visible: boolean): void
|
|
85
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
86
86
|
/**
|
|
87
87
|
* Shows the editable text bubble for this comment, and adds change listeners
|
|
88
88
|
* to update the state of this icon in response to changes in the bubble.
|
|
@@ -103,10 +103,15 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
103
103
|
*/
|
|
104
104
|
private getBubbleOwnerRect;
|
|
105
105
|
}
|
|
106
|
+
/** The save state format for a comment icon. */
|
|
106
107
|
export interface CommentState {
|
|
108
|
+
/** The text of the comment. */
|
|
107
109
|
text?: string;
|
|
110
|
+
/** True if the comment is open, false otherwise. */
|
|
108
111
|
pinned?: boolean;
|
|
112
|
+
/** The height of the comment bubble. */
|
|
109
113
|
height?: number;
|
|
114
|
+
/** The width of the comment bubble. */
|
|
110
115
|
width?: number;
|
|
111
116
|
}
|
|
112
117
|
//# sourceMappingURL=comment_icon.d.ts.map
|
package/core/icons/icon.d.ts
CHANGED
|
@@ -59,11 +59,5 @@ export declare abstract class Icon implements IIcon {
|
|
|
59
59
|
* @returns Whether the icon should be clickable while the block is in a flyout.
|
|
60
60
|
*/
|
|
61
61
|
isClickableInFlyout(autoClosingFlyout: boolean): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Sets the visibility of the icon's bubble if one exists.
|
|
64
|
-
*
|
|
65
|
-
* @deprecated Use `setBubbleVisible` instead. To be removed in v11.
|
|
66
|
-
*/
|
|
67
|
-
setVisible(visibility: boolean): void;
|
|
68
62
|
}
|
|
69
63
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ICommentIcon } from '../interfaces/i_comment_icon.js';
|
|
6
7
|
import { IIcon } from '../interfaces/i_icon.js';
|
|
7
|
-
import { CommentIcon } from './comment_icon.js';
|
|
8
8
|
import { MutatorIcon } from './mutator_icon.js';
|
|
9
9
|
import { WarningIcon } from './warning_icon.js';
|
|
10
10
|
/**
|
|
@@ -20,6 +20,6 @@ export declare class IconType<_T extends IIcon> {
|
|
|
20
20
|
equals(type: IconType<IIcon>): boolean;
|
|
21
21
|
static MUTATOR: IconType<MutatorIcon>;
|
|
22
22
|
static WARNING: IconType<WarningIcon>;
|
|
23
|
-
static COMMENT: IconType<
|
|
23
|
+
static COMMENT: IconType<ICommentIcon>;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=icon_types.d.ts.map
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Abstract } from '../events/events_abstract.js';
|
|
7
|
-
import type { Block } from '../block.js';
|
|
8
7
|
import type { BlockSvg } from '../block_svg.js';
|
|
9
|
-
import type { Connection } from '../connection.js';
|
|
10
8
|
import { Coordinate } from '../utils/coordinate.js';
|
|
11
9
|
import type { IHasBubble } from '../interfaces/i_has_bubble.js';
|
|
12
10
|
import { Icon } from './icon.js';
|
|
@@ -55,7 +53,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
|
|
|
55
53
|
onClick(): void;
|
|
56
54
|
isClickableInFlyout(): boolean;
|
|
57
55
|
bubbleIsVisible(): boolean;
|
|
58
|
-
setBubbleVisible(visible: boolean): void
|
|
56
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
59
57
|
/** @returns the configuration the mini workspace should have. */
|
|
60
58
|
private getMiniWorkspaceConfig;
|
|
61
59
|
/**
|
|
@@ -91,18 +89,5 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
|
|
|
91
89
|
* currently open.
|
|
92
90
|
*/
|
|
93
91
|
getWorkspace(): WorkspaceSvg | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Reconnects the given connection to the mutated input on the given block.
|
|
96
|
-
*
|
|
97
|
-
* @deprecated Use connection.reconnect instead. To be removed in v11.
|
|
98
|
-
*/
|
|
99
|
-
static reconnect(connectionChild: Connection | null, block: Block, inputName: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the parent workspace of a workspace that is inside a mini workspace
|
|
102
|
-
* bubble, taking into account whether the workspace is a flyout.
|
|
103
|
-
*
|
|
104
|
-
* @deprecated Use workspace.getRootWorkspace. To be removed in v11.
|
|
105
|
-
*/
|
|
106
|
-
static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg | null;
|
|
107
92
|
}
|
|
108
93
|
//# sourceMappingURL=mutator_icon.d.ts.map
|
|
@@ -59,7 +59,7 @@ export declare class WarningIcon extends Icon implements IHasBubble {
|
|
|
59
59
|
onClick(): void;
|
|
60
60
|
isClickableInFlyout(): boolean;
|
|
61
61
|
bubbleIsVisible(): boolean;
|
|
62
|
-
setBubbleVisible(visible: boolean): void
|
|
62
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
63
63
|
/**
|
|
64
64
|
* @returns the location the bubble should be anchored to.
|
|
65
65
|
* I.E. the middle of this icon.
|
package/core/inputs/input.d.ts
CHANGED
|
@@ -15,13 +15,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
17
|
import { inputTypes } from './input_types.js';
|
|
18
|
+
import { Align } from './align.js';
|
|
18
19
|
/** Class for an input with optional fields. */
|
|
19
20
|
export declare class Input {
|
|
20
21
|
name: string;
|
|
21
22
|
private sourceBlock;
|
|
22
23
|
fieldRow: Field[];
|
|
23
24
|
/** Alignment of input's fields (left, right or centre). */
|
|
24
|
-
align:
|
|
25
|
+
align: Align;
|
|
25
26
|
/** Is the input visible? */
|
|
26
27
|
private visible;
|
|
27
28
|
readonly type: inputTypes;
|
|
@@ -121,6 +122,14 @@ export declare class Input {
|
|
|
121
122
|
getShadowDom(): Element | null;
|
|
122
123
|
/** Initialize the fields on this input. */
|
|
123
124
|
init(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Initializes the fields on this input for a headless block.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
initModel(): void;
|
|
131
|
+
/** Initializes the given field. */
|
|
132
|
+
private initField;
|
|
124
133
|
/**
|
|
125
134
|
* Sever all links to this input.
|
|
126
135
|
*/
|
|
@@ -135,22 +144,4 @@ export declare class Input {
|
|
|
135
144
|
*/
|
|
136
145
|
protected makeConnection(type: ConnectionType): Connection;
|
|
137
146
|
}
|
|
138
|
-
export declare namespace Input {
|
|
139
|
-
/**
|
|
140
|
-
* Enum for alignment of inputs.
|
|
141
|
-
*
|
|
142
|
-
* @deprecated Use Blockly.inputs.Align. To be removed in v11.
|
|
143
|
-
*/
|
|
144
|
-
enum Align {
|
|
145
|
-
LEFT = -1,
|
|
146
|
-
CENTRE = 0,
|
|
147
|
-
RIGHT = 1
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
|
|
151
|
-
/** @suppress {deprecated} */
|
|
152
|
-
export type Align = Input.Align;
|
|
153
|
-
/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
|
|
154
|
-
/** @suppress {deprecated} */
|
|
155
|
-
export declare const Align: typeof Input.Align;
|
|
156
147
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { BlockSvg } from '
|
|
7
|
-
import { IConnectionPreviewer } from '
|
|
8
|
-
import { RenderedConnection } from '
|
|
6
|
+
import { BlockSvg } from './block_svg.js';
|
|
7
|
+
import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
8
|
+
import { RenderedConnection } from './rendered_connection.js';
|
|
9
9
|
export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
10
10
|
private readonly workspace;
|
|
11
11
|
private fadedBlock;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CommentState } from '../icons/comment_icon.js';
|
|
7
|
+
import { IIcon } from './i_icon.js';
|
|
8
|
+
import { Size } from '../utils/size.js';
|
|
9
|
+
import { IHasBubble } from './i_has_bubble.js';
|
|
10
|
+
import { ISerializable } from './i_serializable.js';
|
|
11
|
+
export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
|
|
12
|
+
setText(text: string): void;
|
|
13
|
+
getText(): string;
|
|
14
|
+
setBubbleSize(size: Size): void;
|
|
15
|
+
getBubbleSize(): Size;
|
|
16
|
+
saveState(): CommentState;
|
|
17
|
+
loadState(state: CommentState): void;
|
|
18
|
+
}
|
|
19
|
+
/** Checks whether the given object is an ICommentIcon. */
|
|
20
|
+
export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
|
|
21
|
+
//# sourceMappingURL=i_comment_icon.d.ts.map
|