blockly 11.0.0-beta.6 → 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 +352 -340
- package/blockly_compressed.js +341 -329
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -3
- package/core/block_svg.d.ts +23 -10
- package/core/blockly.d.ts +8 -13
- 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/comments/comment_view.d.ts +7 -1
- package/core/comments/rendered_workspace_comment.d.ts +36 -3
- package/core/comments/workspace_comment.d.ts +9 -3
- 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_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/flyout_base.d.ts +17 -1
- package/core/flyout_button.d.ts +26 -1
- package/core/gesture.d.ts +23 -54
- package/core/icons/comment_icon.d.ts +5 -0
- package/core/interfaces/i_comment_icon.d.ts +5 -1
- 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_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/registry.d.ts +2 -2
- package/core/renderers/common/marker_svg.d.ts +7 -0
- package/core/toolbox/toolbox.d.ts +1 -2
- package/core/workspace_comment_svg.d.ts +1 -2
- package/core/xml.d.ts +5 -0
- package/dart_compressed.js +8 -8
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +10 -10
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +6 -7
- package/lua_compressed.js.map +1 -1
- package/media/delete-icon.svg +1 -0
- package/package.json +2 -2
- package/php_compressed.js +7 -7
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +3 -3
- package/python_compressed.js.map +1 -1
- package/core/block_dragger.d.ts +0 -212
- package/core/bubble_dragger.d.ts +0 -77
- package/core/interfaces/i_block_dragger.d.ts +0 -47
- /package/media/{arrow-dropdown.svg → foldout-icon.svg} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
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
7
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
8
|
import type { Workspace } from '../workspace.js';
|
|
9
9
|
/**
|
|
@@ -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/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/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,10 +80,7 @@ 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.
|
|
@@ -96,7 +96,6 @@ export declare class Gesture {
|
|
|
96
96
|
private gestureHasStarted;
|
|
97
97
|
/** Boolean used internally to break a cycle in disposal. */
|
|
98
98
|
protected isEnding_: boolean;
|
|
99
|
-
private healStack;
|
|
100
99
|
/** The event that most recently updated this gesture. */
|
|
101
100
|
private mostRecentEvent;
|
|
102
101
|
/** Boolean for whether or not this gesture is a multi-touch gesture. */
|
|
@@ -160,30 +159,6 @@ export declare class Gesture {
|
|
|
160
159
|
* @returns True if a block is being dragged from the flyout.
|
|
161
160
|
*/
|
|
162
161
|
private updateIsDraggingFromFlyout;
|
|
163
|
-
/**
|
|
164
|
-
* Update this gesture to record whether a bubble is being dragged.
|
|
165
|
-
* This function should be called on a pointermove event the first time
|
|
166
|
-
* the drag radius is exceeded. It should be called no more than once per
|
|
167
|
-
* gesture. If a bubble should be dragged this function creates the necessary
|
|
168
|
-
* BubbleDragger and starts the drag.
|
|
169
|
-
*
|
|
170
|
-
* @returns True if a bubble is being dragged.
|
|
171
|
-
*/
|
|
172
|
-
private updateIsDraggingBubble;
|
|
173
|
-
/**
|
|
174
|
-
* Check whether to start a block drag. If a block should be dragged, either
|
|
175
|
-
* from the flyout or in the workspace, create the necessary BlockDragger and
|
|
176
|
-
* start the drag.
|
|
177
|
-
*
|
|
178
|
-
* This function should be called on a pointermove event the first time
|
|
179
|
-
* the drag radius is exceeded. It should be called no more than once per
|
|
180
|
-
* gesture. If a block should be dragged, either from the flyout or in the
|
|
181
|
-
* workspace, this function creates the necessary BlockDragger and starts the
|
|
182
|
-
* drag.
|
|
183
|
-
*
|
|
184
|
-
* @returns True if a block is being dragged.
|
|
185
|
-
*/
|
|
186
|
-
private updateIsDraggingBlock;
|
|
187
162
|
/**
|
|
188
163
|
* Check whether to start a workspace drag. If a workspace is being dragged,
|
|
189
164
|
* create the necessary WorkspaceDragger and start the drag.
|
|
@@ -201,10 +176,7 @@ export declare class Gesture {
|
|
|
201
176
|
* gesture.
|
|
202
177
|
*/
|
|
203
178
|
private updateIsDragging;
|
|
204
|
-
|
|
205
|
-
private startDraggingBlock;
|
|
206
|
-
/** Create a bubble dragger and start dragging the selected bubble. */
|
|
207
|
-
private startDraggingBubble;
|
|
179
|
+
private createDragger;
|
|
208
180
|
/**
|
|
209
181
|
* Start a gesture: update the workspace to indicate that a gesture is in
|
|
210
182
|
* progress and bind pointermove and pointerup handlers.
|
|
@@ -337,8 +309,14 @@ export declare class Gesture {
|
|
|
337
309
|
* @internal
|
|
338
310
|
*/
|
|
339
311
|
handleBubbleStart(e: PointerEvent, bubble: IBubble): void;
|
|
340
|
-
/**
|
|
341
|
-
|
|
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;
|
|
342
320
|
/** Execute a field click. */
|
|
343
321
|
private doFieldClick;
|
|
344
322
|
/** Execute an icon click. */
|
|
@@ -378,6 +356,13 @@ export declare class Gesture {
|
|
|
378
356
|
* @internal
|
|
379
357
|
*/
|
|
380
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;
|
|
381
366
|
/**
|
|
382
367
|
* Record the block that a gesture started on, and set the target block
|
|
383
368
|
* appropriately.
|
|
@@ -454,22 +439,6 @@ export declare class Gesture {
|
|
|
454
439
|
* @internal
|
|
455
440
|
*/
|
|
456
441
|
hasStarted(): boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Get a list of the insertion markers that currently exist. Block drags have
|
|
459
|
-
* 0, 1, or 2 insertion markers.
|
|
460
|
-
*
|
|
461
|
-
* @returns A possibly empty list of insertion marker blocks.
|
|
462
|
-
* @internal
|
|
463
|
-
*/
|
|
464
|
-
getInsertionMarkers(): BlockSvg[];
|
|
465
|
-
/**
|
|
466
|
-
* Gets the current dragger if an item is being dragged. Null if nothing is
|
|
467
|
-
* being dragged.
|
|
468
|
-
*
|
|
469
|
-
* @returns The dragger that is currently in use or null if no drag is in
|
|
470
|
-
* progress.
|
|
471
|
-
*/
|
|
472
|
-
getCurrentDragger(): WorkspaceDragger | BubbleDragger | IBlockDragger | null;
|
|
473
442
|
/**
|
|
474
443
|
* Is a drag or other gesture currently in progress on any workspace?
|
|
475
444
|
*
|
|
@@ -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
|
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { CommentState } from '../icons/comment_icon.js';
|
|
6
7
|
import { IIcon } from './i_icon.js';
|
|
7
8
|
import { Size } from '../utils/size.js';
|
|
8
9
|
import { IHasBubble } from './i_has_bubble.js';
|
|
9
|
-
|
|
10
|
+
import { ISerializable } from './i_serializable.js';
|
|
11
|
+
export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
|
|
10
12
|
setText(text: string): void;
|
|
11
13
|
getText(): string;
|
|
12
14
|
setBubbleSize(size: Size): void;
|
|
13
15
|
getBubbleSize(): Size;
|
|
16
|
+
saveState(): CommentState;
|
|
17
|
+
loadState(state: CommentState): void;
|
|
14
18
|
}
|
|
15
19
|
/** Checks whether the given object is an ICommentIcon. */
|
|
16
20
|
export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
|
|
@@ -13,5 +13,11 @@ export interface IDeletable {
|
|
|
13
13
|
* @returns True if deletable.
|
|
14
14
|
*/
|
|
15
15
|
isDeletable(): boolean;
|
|
16
|
+
/** Disposes of this object, cleaning up any references or DOM elements. */
|
|
17
|
+
dispose(): void;
|
|
18
|
+
/** Visually indicates that the object is pending deletion. */
|
|
19
|
+
setDeleteStyle(wouldDelete: boolean): void;
|
|
16
20
|
}
|
|
21
|
+
/** Returns whether the given object is an IDeletable. */
|
|
22
|
+
export declare function isDeletable(obj: any): obj is IDeletable;
|
|
17
23
|
//# sourceMappingURL=i_deletable.d.ts.map
|
|
@@ -17,10 +17,9 @@ export interface IDeleteArea extends IDragTarget {
|
|
|
17
17
|
* before onDragEnter/onDragOver/onDragExit.
|
|
18
18
|
*
|
|
19
19
|
* @param element The block or bubble currently being dragged.
|
|
20
|
-
* @param couldConnect Whether the element could could connect to another.
|
|
21
20
|
* @returns Whether the element provided would be deleted if dropped on this
|
|
22
21
|
* area.
|
|
23
22
|
*/
|
|
24
|
-
wouldDelete(element: IDraggable
|
|
23
|
+
wouldDelete(element: IDraggable): boolean;
|
|
25
24
|
}
|
|
26
25
|
//# sourceMappingURL=i_delete_area.d.ts.map
|
|
@@ -3,10 +3,54 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { Coordinate } from '../utils/coordinate';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Represents an object that can be dragged.
|
|
9
9
|
*/
|
|
10
|
-
export interface IDraggable extends
|
|
10
|
+
export interface IDraggable extends IDragStrategy {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current location of the draggable in workspace
|
|
13
|
+
* coordinates.
|
|
14
|
+
*
|
|
15
|
+
* @returns Coordinate of current location on workspace.
|
|
16
|
+
*/
|
|
17
|
+
getRelativeToSurfaceXY(): Coordinate;
|
|
11
18
|
}
|
|
19
|
+
export interface IDragStrategy {
|
|
20
|
+
/** Returns true iff the element is currently movable. */
|
|
21
|
+
isMovable(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Handles any drag startup (e.g moving elements to the front of the
|
|
24
|
+
* workspace).
|
|
25
|
+
*
|
|
26
|
+
* @param e PointerEvent that started the drag; can be used to
|
|
27
|
+
* check modifier keys, etc. May be missing when dragging is
|
|
28
|
+
* triggered programatically rather than by user.
|
|
29
|
+
*/
|
|
30
|
+
startDrag(e?: PointerEvent): void;
|
|
31
|
+
/**
|
|
32
|
+
* Handles moving elements to the new location, and updating any
|
|
33
|
+
* visuals based on that (e.g connection previews for blocks).
|
|
34
|
+
*
|
|
35
|
+
* @param newLoc Workspace coordinate to which the draggable has
|
|
36
|
+
* been dragged.
|
|
37
|
+
* @param e PointerEvent that continued the drag. Can be
|
|
38
|
+
* used to check modifier keys, etc.
|
|
39
|
+
*/
|
|
40
|
+
drag(newLoc: Coordinate, e?: PointerEvent): void;
|
|
41
|
+
/**
|
|
42
|
+
* Handles any drag cleanup, including e.g. connecting or deleting
|
|
43
|
+
* blocks.
|
|
44
|
+
*
|
|
45
|
+
* @param newLoc Workspace coordinate at which the drag finished.
|
|
46
|
+
* been dragged.
|
|
47
|
+
* @param e PointerEvent that finished the drag. Can be
|
|
48
|
+
* used to check modifier keys, etc.
|
|
49
|
+
*/
|
|
50
|
+
endDrag(e?: PointerEvent): void;
|
|
51
|
+
/** Moves the draggable back to where it was at the start of the drag. */
|
|
52
|
+
revertDrag(): void;
|
|
53
|
+
}
|
|
54
|
+
/** Returns whether the given object is an IDraggable or not. */
|
|
55
|
+
export declare function isDraggable(obj: any): obj is IDraggable;
|
|
12
56
|
//# sourceMappingURL=i_draggable.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Coordinate } from '../utils/coordinate';
|
|
7
|
+
export interface IDragger {
|
|
8
|
+
/**
|
|
9
|
+
* Handles any drag startup.
|
|
10
|
+
*
|
|
11
|
+
* @param e PointerEvent that started the drag.
|
|
12
|
+
*/
|
|
13
|
+
onDragStart(e: PointerEvent): void;
|
|
14
|
+
/**
|
|
15
|
+
* Handles dragging, including calculating where the element should
|
|
16
|
+
* actually be moved to.
|
|
17
|
+
*
|
|
18
|
+
* @param e PointerEvent that continued the drag.
|
|
19
|
+
* @param totalDelta The total distance, in pixels, that the mouse
|
|
20
|
+
* has moved since the start of the drag.
|
|
21
|
+
*/
|
|
22
|
+
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
23
|
+
/**
|
|
24
|
+
* Handles any drag cleanup.
|
|
25
|
+
*
|
|
26
|
+
* @param e PointerEvent that finished the drag.
|
|
27
|
+
* @param totalDelta The total distance, in pixels, that the mouse
|
|
28
|
+
* has moved since the start of the drag.
|
|
29
|
+
*/
|
|
30
|
+
onDragEnd(e: PointerEvent, totalDelta: Coordinate): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=i_dragger.d.ts.map
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
import type { IMovable } from './i_movable.js';
|
|
6
|
+
import type { Workspace } from '../workspace.js';
|
|
8
7
|
/**
|
|
9
8
|
* The interface for an object that is selectable.
|
|
10
9
|
*/
|
|
11
|
-
export interface ISelectable
|
|
10
|
+
export interface ISelectable {
|
|
12
11
|
id: string;
|
|
12
|
+
workspace: Workspace;
|
|
13
13
|
/** Select this. Highlight it visually. */
|
|
14
14
|
select(): void;
|
|
15
15
|
/** Unselect this. Unhighlight it visually. */
|
|
16
16
|
unselect(): void;
|
|
17
17
|
}
|
|
18
|
+
/** Checks whether the given object is an ISelectable. */
|
|
19
|
+
export declare function isSelectable(obj: Object): obj is ISelectable;
|
|
18
20
|
//# sourceMappingURL=i_selectable.d.ts.map
|
|
@@ -9,13 +9,6 @@
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare const COLLAPSE_CHARS = 30;
|
|
12
|
-
/**
|
|
13
|
-
* When dragging a block out of a stack, split the stack in two (true), or drag
|
|
14
|
-
* out the block healing the stack (false).
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare const DRAG_STACK = true;
|
|
19
12
|
/**
|
|
20
13
|
* Lookup table for determining the opposite type of a connection.
|
|
21
14
|
*
|
|
@@ -16,6 +16,7 @@ import type { Input } from '../inputs/input.js';
|
|
|
16
16
|
import type { IASTNodeLocation } from '../interfaces/i_ast_node_location.js';
|
|
17
17
|
import { Coordinate } from '../utils/coordinate.js';
|
|
18
18
|
import type { Workspace } from '../workspace.js';
|
|
19
|
+
import { FlyoutButton } from '../flyout_button.js';
|
|
19
20
|
/**
|
|
20
21
|
* Class for an AST node.
|
|
21
22
|
* It is recommended that you use one of the createNode methods instead of
|
|
@@ -119,6 +120,13 @@ export declare class ASTNode {
|
|
|
119
120
|
* on the workspace.
|
|
120
121
|
*/
|
|
121
122
|
private navigateBetweenStacks;
|
|
123
|
+
/**
|
|
124
|
+
* Navigate between buttons and stacks of blocks on the flyout workspace.
|
|
125
|
+
*
|
|
126
|
+
* @param forward True to go forward. False to go backwards.
|
|
127
|
+
* @returns The next button, or next stack's first block, or null
|
|
128
|
+
*/
|
|
129
|
+
private navigateFlyoutContents;
|
|
122
130
|
/**
|
|
123
131
|
* Finds the top most AST node for a given block.
|
|
124
132
|
* This is either the previous connection, output connection or block
|
|
@@ -150,7 +158,7 @@ export declare class ASTNode {
|
|
|
150
158
|
* Finds the source block of the location of this node.
|
|
151
159
|
*
|
|
152
160
|
* @returns The source block of the location, or null if the node is of type
|
|
153
|
-
* workspace.
|
|
161
|
+
* workspace or button.
|
|
154
162
|
*/
|
|
155
163
|
getSourceBlock(): Block | null;
|
|
156
164
|
/**
|
|
@@ -232,6 +240,16 @@ export declare class ASTNode {
|
|
|
232
240
|
* stack.
|
|
233
241
|
*/
|
|
234
242
|
static createStackNode(topBlock: Block): ASTNode | null;
|
|
243
|
+
/**
|
|
244
|
+
* Create an AST node of type button. A button in this case refers
|
|
245
|
+
* specifically to a button in a flyout.
|
|
246
|
+
*
|
|
247
|
+
* @param button A top block has no parent and can be found in the list
|
|
248
|
+
* returned by workspace.getTopBlocks().
|
|
249
|
+
* @returns An AST node of type stack that points to the top block on the
|
|
250
|
+
* stack.
|
|
251
|
+
*/
|
|
252
|
+
static createButtonNode(button: FlyoutButton): ASTNode | null;
|
|
235
253
|
/**
|
|
236
254
|
* Creates an AST node pointing to a workspace.
|
|
237
255
|
*
|
|
@@ -262,7 +280,8 @@ export declare namespace ASTNode {
|
|
|
262
280
|
NEXT = "next",
|
|
263
281
|
PREVIOUS = "previous",
|
|
264
282
|
STACK = "stack",
|
|
265
|
-
WORKSPACE = "workspace"
|
|
283
|
+
WORKSPACE = "workspace",
|
|
284
|
+
BUTTON = "button"
|
|
266
285
|
}
|
|
267
286
|
}
|
|
268
287
|
export type Params = ASTNode.Params;
|
package/core/registry.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Abstract } from './events/events_abstract.js';
|
|
7
7
|
import type { Field } from './field.js';
|
|
8
|
-
import type { IBlockDragger } from './interfaces/i_block_dragger.js';
|
|
9
8
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
10
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
11
10
|
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
@@ -21,6 +20,7 @@ import type { ToolboxItem } from './toolbox/toolbox_item.js';
|
|
|
21
20
|
import type { IPaster } from './interfaces/i_paster.js';
|
|
22
21
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
23
22
|
import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
23
|
+
import type { IDragger } from './interfaces/i_dragger.js';
|
|
24
24
|
export declare const TEST_ONLY: {
|
|
25
25
|
typeMap: {
|
|
26
26
|
[key: string]: {
|
|
@@ -58,7 +58,7 @@ export declare class Type<_T> {
|
|
|
58
58
|
static FLYOUTS_VERTICAL_TOOLBOX: Type<IFlyout>;
|
|
59
59
|
static FLYOUTS_HORIZONTAL_TOOLBOX: Type<IFlyout>;
|
|
60
60
|
static METRICS_MANAGER: Type<IMetricsManager>;
|
|
61
|
-
static
|
|
61
|
+
static DRAGGER: Type<IDragger>;
|
|
62
62
|
/** @internal */
|
|
63
63
|
static SERIALIZER: Type<ISerializer>;
|
|
64
64
|
/** @internal */
|