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
package/core/block.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ import type { Abstract } from './events/events_abstract.js';
|
|
|
17
17
|
import type { Field } from './field.js';
|
|
18
18
|
import { Input } from './inputs/input.js';
|
|
19
19
|
import type { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
20
|
-
import type { IDeletable } from './interfaces/i_deletable.js';
|
|
21
20
|
import { type IIcon } from './interfaces/i_icon.js';
|
|
22
21
|
import type { MutatorIcon } from './icons/mutator_icon.js';
|
|
23
22
|
import * as Tooltip from './tooltip.js';
|
|
@@ -30,7 +29,7 @@ import { IconType } from './icons/icon_types.js';
|
|
|
30
29
|
* Class for one block.
|
|
31
30
|
* Not normally called directly, workspace.newBlock() is preferred.
|
|
32
31
|
*/
|
|
33
|
-
export declare class Block implements IASTNodeLocation
|
|
32
|
+
export declare class Block implements IASTNodeLocation {
|
|
34
33
|
/**
|
|
35
34
|
* An optional callback method to use whenever the block's parent workspace
|
|
36
35
|
* changes. This is usually only called from the constructor, the block type
|
|
@@ -188,7 +187,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
188
187
|
* statement with the previous statement. Otherwise, dispose of all
|
|
189
188
|
* children of this block.
|
|
190
189
|
*/
|
|
191
|
-
dispose(healStack
|
|
190
|
+
dispose(healStack?: boolean): void;
|
|
192
191
|
/**
|
|
193
192
|
* Disposes of this block without doing things required by the top block.
|
|
194
193
|
* E.g. does not fire events, unplug the block, etc.
|
package/core/block_svg.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { Input } from './inputs/input.js';
|
|
|
18
18
|
import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
|
|
19
19
|
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
20
20
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
21
|
-
import type { IDraggable } from './interfaces/i_draggable.js';
|
|
21
|
+
import type { IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
|
|
22
22
|
import { IIcon } from './interfaces/i_icon.js';
|
|
23
23
|
import { MutatorIcon } from './icons/mutator_icon.js';
|
|
24
24
|
import { RenderedConnection } from './rendered_connection.js';
|
|
@@ -30,11 +30,13 @@ import type { Workspace } from './workspace.js';
|
|
|
30
30
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
31
31
|
import { IconType } from './icons/icon_types.js';
|
|
32
32
|
import { BlockCopyData } from './clipboard/block_paster.js';
|
|
33
|
+
import { IDeletable } from './blockly.js';
|
|
34
|
+
import { FlyoutItemInfo } from './utils/toolbox.js';
|
|
33
35
|
/**
|
|
34
36
|
* Class for a block's SVG representation.
|
|
35
37
|
* Not normally called directly, workspace.newBlock() is preferred.
|
|
36
38
|
*/
|
|
37
|
-
export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, ICopyable<BlockCopyData>, IDraggable {
|
|
39
|
+
export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, ICopyable<BlockCopyData>, IDraggable, IDeletable {
|
|
38
40
|
/**
|
|
39
41
|
* Constant for identifying rows that are to be rendered inline.
|
|
40
42
|
* Don't collide with Blockly.inputTypes.
|
|
@@ -95,6 +97,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
95
97
|
* @internal
|
|
96
98
|
*/
|
|
97
99
|
relativeCoords: Coordinate;
|
|
100
|
+
private dragStrategy;
|
|
98
101
|
/**
|
|
99
102
|
* @param workspace The block's workspace.
|
|
100
103
|
* @param prototypeName Name of the language object containing type-specific
|
|
@@ -120,15 +123,9 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
120
123
|
* @returns #RRGGBB string.
|
|
121
124
|
*/
|
|
122
125
|
getColourTertiary(): string | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* Selects this block. Highlights the block visually and fires a select event
|
|
125
|
-
* if the block is not already selected.
|
|
126
|
-
*/
|
|
126
|
+
/** Selects this block. Highlights the block visually. */
|
|
127
127
|
select(): void;
|
|
128
|
-
/**
|
|
129
|
-
* Unselects this block. Unhighlights the block and fires a select (false)
|
|
130
|
-
* event if the block is currently selected.
|
|
131
|
-
*/
|
|
128
|
+
/** Unselects this block. Unhighlights the blockv visually. */
|
|
132
129
|
unselect(): void;
|
|
133
130
|
/**
|
|
134
131
|
* Sets the parent of this block to be a new block or null.
|
|
@@ -647,5 +644,21 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
647
644
|
* @internal
|
|
648
645
|
*/
|
|
649
646
|
highlightShapeForInput(conn: RenderedConnection, add: boolean): void;
|
|
647
|
+
/** Sets the drag strategy for this block. */
|
|
648
|
+
setDragStrategy(dragStrategy: IDragStrategy): void;
|
|
649
|
+
/** Returns whether this block is movable or not. */
|
|
650
|
+
isMovable(): boolean;
|
|
651
|
+
/** Starts a drag on the block. */
|
|
652
|
+
startDrag(e?: PointerEvent): void;
|
|
653
|
+
/** Drags the block to the given location. */
|
|
654
|
+
drag(newLoc: Coordinate, e?: PointerEvent): void;
|
|
655
|
+
/** Ends the drag on the block. */
|
|
656
|
+
endDrag(e?: PointerEvent): void;
|
|
657
|
+
/** Moves the block back to where it was at the start of a drag. */
|
|
658
|
+
revertDrag(): void;
|
|
659
|
+
/**
|
|
660
|
+
* Returns a representation of this block that can be displayed in a flyout.
|
|
661
|
+
*/
|
|
662
|
+
toFlyoutData(): FlyoutItemInfo[];
|
|
650
663
|
}
|
|
651
664
|
//# sourceMappingURL=block_svg.d.ts.map
|
package/core/blockly.d.ts
CHANGED
|
@@ -9,13 +9,11 @@ import './events/events_ui_base.js';
|
|
|
9
9
|
import './events/events_var_create.js';
|
|
10
10
|
import { Block } from './block.js';
|
|
11
11
|
import * as blockAnimations from './block_animations.js';
|
|
12
|
-
import { BlockDragger } from './block_dragger.js';
|
|
13
12
|
import { BlockSvg } from './block_svg.js';
|
|
14
13
|
import { BlocklyOptions } from './blockly_options.js';
|
|
15
14
|
import { Blocks } from './blocks.js';
|
|
16
15
|
import * as browserEvents from './browser_events.js';
|
|
17
16
|
import * as bubbles from './bubbles.js';
|
|
18
|
-
import { BubbleDragger } from './bubble_dragger.js';
|
|
19
17
|
import * as bumpObjects from './bump_objects.js';
|
|
20
18
|
import * as clipboard from './clipboard.js';
|
|
21
19
|
import * as common from './common.js';
|
|
@@ -32,6 +30,7 @@ import * as comments from './comments.js';
|
|
|
32
30
|
import * as Css from './css.js';
|
|
33
31
|
import { DeleteArea } from './delete_area.js';
|
|
34
32
|
import * as dialog from './dialog.js';
|
|
33
|
+
import { Dragger } from './dragging/dragger.js';
|
|
35
34
|
import { DragTarget } from './drag_target.js';
|
|
36
35
|
import * as dropDownDiv from './dropdowndiv.js';
|
|
37
36
|
import * as Events from './events/events.js';
|
|
@@ -64,7 +63,6 @@ import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
|
64
63
|
import { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
|
|
65
64
|
import { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
|
|
66
65
|
import { IAutoHideable } from './interfaces/i_autohideable.js';
|
|
67
|
-
import { IBlockDragger } from './interfaces/i_block_dragger.js';
|
|
68
66
|
import { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
69
67
|
import { IBubble } from './interfaces/i_bubble.js';
|
|
70
68
|
import { ICollapsibleToolboxItem } from './interfaces/i_collapsible_toolbox_item.js';
|
|
@@ -73,10 +71,10 @@ import { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
|
73
71
|
import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
74
72
|
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
75
73
|
import { ICopyable, isCopyable } from './interfaces/i_copyable.js';
|
|
76
|
-
import { IDeletable } from './interfaces/i_deletable.js';
|
|
74
|
+
import { IDeletable, isDeletable } from './interfaces/i_deletable.js';
|
|
77
75
|
import { IDeleteArea } from './interfaces/i_delete_area.js';
|
|
78
76
|
import { IDragTarget } from './interfaces/i_drag_target.js';
|
|
79
|
-
import { IDraggable } from './interfaces/i_draggable.js';
|
|
77
|
+
import { IDraggable, isDraggable } from './interfaces/i_draggable.js';
|
|
80
78
|
import { IFlyout } from './interfaces/i_flyout.js';
|
|
81
79
|
import { IHasBubble, hasBubble } from './interfaces/i_has_bubble.js';
|
|
82
80
|
import { IIcon, isIcon } from './interfaces/i_icon.js';
|
|
@@ -87,7 +85,7 @@ import { IObservable, isObservable } from './interfaces/i_observable.js';
|
|
|
87
85
|
import { IPaster, isPaster } from './interfaces/i_paster.js';
|
|
88
86
|
import { IPositionable } from './interfaces/i_positionable.js';
|
|
89
87
|
import { IRegistrable } from './interfaces/i_registrable.js';
|
|
90
|
-
import { ISelectable } from './interfaces/i_selectable.js';
|
|
88
|
+
import { ISelectable, isSelectable } from './interfaces/i_selectable.js';
|
|
91
89
|
import { ISelectableToolboxItem } from './interfaces/i_selectable_toolbox_item.js';
|
|
92
90
|
import { ISerializable, isSerializable } from './interfaces/i_serializable.js';
|
|
93
91
|
import { IStyleable } from './interfaces/i_styleable.js';
|
|
@@ -239,7 +237,6 @@ export declare const defineBlocksWithJsonArray: typeof common.defineBlocksWithJs
|
|
|
239
237
|
*/
|
|
240
238
|
export declare const setParentContainer: typeof common.setParentContainer;
|
|
241
239
|
export declare const COLLAPSE_CHARS = 30;
|
|
242
|
-
export declare const DRAG_STACK = true;
|
|
243
240
|
export declare const OPPOSITE_TYPE: number[];
|
|
244
241
|
export declare const RENAME_VARIABLE_ID = "RENAME_VARIABLE_ID";
|
|
245
242
|
export declare const DELETE_VARIABLE_ID = "DELETE_VARIABLE_ID";
|
|
@@ -297,11 +294,9 @@ export { ASTNode };
|
|
|
297
294
|
export { BasicCursor };
|
|
298
295
|
export { Block };
|
|
299
296
|
export { BlocklyOptions };
|
|
300
|
-
export { BlockDragger };
|
|
301
297
|
export { BlockSvg };
|
|
302
298
|
export { Blocks };
|
|
303
299
|
export { bubbles };
|
|
304
|
-
export { BubbleDragger };
|
|
305
300
|
export { CollapsibleToolboxCategory };
|
|
306
301
|
export { ComponentManager };
|
|
307
302
|
export { Connection };
|
|
@@ -312,6 +307,7 @@ export { ContextMenuRegistry };
|
|
|
312
307
|
export { comments };
|
|
313
308
|
export { Cursor };
|
|
314
309
|
export { DeleteArea };
|
|
310
|
+
export { Dragger };
|
|
315
311
|
export { DragTarget };
|
|
316
312
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
317
313
|
export { Field, FieldConfig, FieldValidator, UnattachedFieldError };
|
|
@@ -335,7 +331,6 @@ export { IASTNodeLocation };
|
|
|
335
331
|
export { IASTNodeLocationSvg };
|
|
336
332
|
export { IASTNodeLocationWithBlock };
|
|
337
333
|
export { IAutoHideable };
|
|
338
|
-
export { IBlockDragger };
|
|
339
334
|
export { IBoundedElement };
|
|
340
335
|
export { IBubble };
|
|
341
336
|
export { ICollapsibleToolboxItem };
|
|
@@ -345,10 +340,10 @@ export { IConnectionPreviewer };
|
|
|
345
340
|
export { IContextMenu };
|
|
346
341
|
export { icons };
|
|
347
342
|
export { ICopyable, isCopyable };
|
|
348
|
-
export { IDeletable };
|
|
343
|
+
export { IDeletable, isDeletable };
|
|
349
344
|
export { IDeleteArea };
|
|
350
345
|
export { IDragTarget };
|
|
351
|
-
export { IDraggable };
|
|
346
|
+
export { IDraggable, isDraggable };
|
|
352
347
|
export { IFlyout };
|
|
353
348
|
export { IHasBubble, hasBubble };
|
|
354
349
|
export { IIcon, isIcon };
|
|
@@ -363,7 +358,7 @@ export { IObservable, isObservable };
|
|
|
363
358
|
export { IPaster, isPaster };
|
|
364
359
|
export { IPositionable };
|
|
365
360
|
export { IRegistrable };
|
|
366
|
-
export { ISelectable };
|
|
361
|
+
export { ISelectable, isSelectable };
|
|
367
362
|
export { ISelectableToolboxItem };
|
|
368
363
|
export { ISerializable, isSerializable };
|
|
369
364
|
export { IStyleable };
|
package/core/bubbles/bubble.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ import { Coordinate } from '../utils/coordinate.js';
|
|
|
8
8
|
import { Rect } from '../utils/rect.js';
|
|
9
9
|
import { Size } from '../utils/size.js';
|
|
10
10
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
11
|
+
import { ISelectable } from '../blockly.js';
|
|
11
12
|
/**
|
|
12
13
|
* The abstract pop-up bubble class. This creates a UI that looks like a speech
|
|
13
14
|
* bubble, where it has a "tail" that points to the block, and a "head" that
|
|
14
15
|
* displays arbitrary svg elements.
|
|
15
16
|
*/
|
|
16
|
-
export declare abstract class Bubble implements IBubble {
|
|
17
|
-
|
|
17
|
+
export declare abstract class Bubble implements IBubble, ISelectable {
|
|
18
|
+
readonly workspace: WorkspaceSvg;
|
|
18
19
|
protected anchor: Coordinate;
|
|
19
20
|
protected ownerRect?: Rect | undefined;
|
|
20
21
|
/** The width of the border around the bubble. */
|
|
@@ -37,6 +38,7 @@ export declare abstract class Bubble implements IBubble {
|
|
|
37
38
|
static readonly TAIL_BEND = 4;
|
|
38
39
|
/** Distance between arrow point and anchor point. */
|
|
39
40
|
static readonly ANCHOR_RADIUS = 8;
|
|
41
|
+
id: string;
|
|
40
42
|
/** The SVG group containing all parts of the bubble. */
|
|
41
43
|
protected svgRoot: SVGGElement;
|
|
42
44
|
/** The SVG path for the arrow from the anchor to the bubble. */
|
|
@@ -57,6 +59,7 @@ export declare abstract class Bubble implements IBubble {
|
|
|
57
59
|
private relativeTop;
|
|
58
60
|
/** The position of the left of the bubble realtive to its anchor. */
|
|
59
61
|
private relativeLeft;
|
|
62
|
+
private dragStrategy;
|
|
60
63
|
/**
|
|
61
64
|
* @param workspace The workspace this bubble belongs to.
|
|
62
65
|
* @param anchor The anchor location of the thing this bubble is attached to.
|
|
@@ -175,5 +178,17 @@ export declare abstract class Bubble implements IBubble {
|
|
|
175
178
|
isDeletable(): boolean;
|
|
176
179
|
/** @internal */
|
|
177
180
|
showContextMenu(_e: Event): void;
|
|
181
|
+
/** Returns whether this bubble is movable or not. */
|
|
182
|
+
isMovable(): boolean;
|
|
183
|
+
/** Starts a drag on the bubble. */
|
|
184
|
+
startDrag(): void;
|
|
185
|
+
/** Drags the bubble to the given location. */
|
|
186
|
+
drag(newLoc: Coordinate): void;
|
|
187
|
+
/** Ends the drag on the bubble. */
|
|
188
|
+
endDrag(): void;
|
|
189
|
+
/** Moves the bubble back to where it was at the start of a drag. */
|
|
190
|
+
revertDrag(): void;
|
|
191
|
+
select(): void;
|
|
192
|
+
unselect(): void;
|
|
178
193
|
}
|
|
179
194
|
//# sourceMappingURL=bubble.d.ts.map
|
|
@@ -15,7 +15,7 @@ import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
|
15
15
|
* Used by the mutator icon.
|
|
16
16
|
*/
|
|
17
17
|
export declare class MiniWorkspaceBubble extends Bubble {
|
|
18
|
-
|
|
18
|
+
readonly workspace: WorkspaceSvg;
|
|
19
19
|
protected anchor: Coordinate;
|
|
20
20
|
protected ownerRect?: Rect | undefined;
|
|
21
21
|
/**
|
|
@@ -12,7 +12,7 @@ import { WorkspaceSvg } from '../workspace_svg.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class TextBubble extends Bubble {
|
|
14
14
|
private text;
|
|
15
|
-
|
|
15
|
+
readonly workspace: WorkspaceSvg;
|
|
16
16
|
protected anchor: Coordinate;
|
|
17
17
|
protected ownerRect?: Rect | undefined;
|
|
18
18
|
private paragraph;
|
|
@@ -13,7 +13,7 @@ import { WorkspaceSvg } from '../workspace_svg.js';
|
|
|
13
13
|
* Used by the comment icon.
|
|
14
14
|
*/
|
|
15
15
|
export declare class TextInputBubble extends Bubble {
|
|
16
|
-
|
|
16
|
+
readonly workspace: WorkspaceSvg;
|
|
17
17
|
protected anchor: Coordinate;
|
|
18
18
|
protected ownerRect?: Rect | undefined;
|
|
19
19
|
/** The root of the elements specific to the text element. */
|
|
@@ -11,8 +11,10 @@ export declare class CommentView implements IRenderedElement {
|
|
|
11
11
|
private readonly workspace;
|
|
12
12
|
/** The root group element of the comment view. */
|
|
13
13
|
private svgRoot;
|
|
14
|
+
/** The group containing all of the top bar elements. */
|
|
15
|
+
private topBarGroup;
|
|
14
16
|
/** The rect background for the top bar. */
|
|
15
|
-
private
|
|
17
|
+
private topBarBackground;
|
|
16
18
|
/** The delete icon that goes in the top bar. */
|
|
17
19
|
private deleteIcon;
|
|
18
20
|
/** The foldout icon that goes in the top bar. */
|
|
@@ -93,6 +95,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
93
95
|
private calcDeleteMargin;
|
|
94
96
|
/** Calculates the margin that should exist around the foldout icon. */
|
|
95
97
|
private calcFoldoutMargin;
|
|
98
|
+
/** Updates the size of the top bar to reflect the new size. */
|
|
99
|
+
private updateTopBarSize;
|
|
96
100
|
/** Updates the size of the text area elements to reflect the new size. */
|
|
97
101
|
private updateTextAreaSize;
|
|
98
102
|
/**
|
|
@@ -107,6 +111,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
107
111
|
* Updates the size and position of the text preview elements to reflect the new size.
|
|
108
112
|
*/
|
|
109
113
|
private updateTextPreviewSize;
|
|
114
|
+
/** Updates the position of the resize handle to reflect the new size. */
|
|
115
|
+
private updateResizeHandlePosition;
|
|
110
116
|
/**
|
|
111
117
|
* Triggers listeners when the size of the comment changes, either
|
|
112
118
|
* progrmatically or manually by the user.
|
|
@@ -10,9 +10,13 @@ import { Rect } from '../utils/rect.js';
|
|
|
10
10
|
import { Size } from '../utils/size.js';
|
|
11
11
|
import { IBoundedElement } from '../interfaces/i_bounded_element.js';
|
|
12
12
|
import { IRenderedElement } from '../interfaces/i_rendered_element.js';
|
|
13
|
-
|
|
13
|
+
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
14
|
+
import { ISelectable } from '../interfaces/i_selectable.js';
|
|
15
|
+
export declare class RenderedWorkspaceComment extends WorkspaceComment implements IBoundedElement, IRenderedElement, IDraggable, ISelectable {
|
|
14
16
|
/** The class encompassing the svg elements making up the workspace comment. */
|
|
15
17
|
private view;
|
|
18
|
+
readonly workspace: WorkspaceSvg;
|
|
19
|
+
private dragStrategy;
|
|
16
20
|
/** Constructs the workspace comment, including the view. */
|
|
17
21
|
constructor(workspace: WorkspaceSvg, id?: string);
|
|
18
22
|
/**
|
|
@@ -33,10 +37,39 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
33
37
|
/** Returns the bounding rectangle of this comment in workspace coordinates. */
|
|
34
38
|
getBoundingRectangle(): Rect;
|
|
35
39
|
/** Move the comment by the given amounts in workspace coordinates. */
|
|
36
|
-
moveBy(dx: number, dy: number,
|
|
40
|
+
moveBy(dx: number, dy: number, reason?: string[] | undefined): void;
|
|
37
41
|
/** Moves the comment to the given location in workspace coordinates. */
|
|
38
|
-
moveTo(location: Coordinate): void;
|
|
42
|
+
moveTo(location: Coordinate, reason?: string[] | undefined): void;
|
|
43
|
+
/**
|
|
44
|
+
* Moves the comment during a drag. Doesn't fire move events.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
moveDuringDrag(location: Coordinate): void;
|
|
49
|
+
/**
|
|
50
|
+
* Adds the dragging CSS class to this comment.
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
setDragging(dragging: boolean): void;
|
|
39
55
|
/** Disposes of the view. */
|
|
40
56
|
dispose(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Starts a gesture because we detected a pointer down on the comment
|
|
59
|
+
* (that wasn't otherwise gobbled up, e.g. by resizing).
|
|
60
|
+
*/
|
|
61
|
+
private startGesture;
|
|
62
|
+
/** Returns whether this comment is movable or not. */
|
|
63
|
+
isMovable(): boolean;
|
|
64
|
+
/** Starts a drag on the comment. */
|
|
65
|
+
startDrag(): void;
|
|
66
|
+
/** Drags the comment to the given location. */
|
|
67
|
+
drag(newLoc: Coordinate): void;
|
|
68
|
+
/** Ends the drag on the comment. */
|
|
69
|
+
endDrag(): void;
|
|
70
|
+
/** Moves the comment back to where it was at the start of a drag. */
|
|
71
|
+
revertDrag(): void;
|
|
72
|
+
select(): void;
|
|
73
|
+
unselect(): void;
|
|
41
74
|
}
|
|
42
75
|
//# sourceMappingURL=rendered_workspace_comment.d.ts.map
|
|
@@ -7,7 +7,7 @@ import { Workspace } from '../workspace.js';
|
|
|
7
7
|
import { Size } from '../utils/size.js';
|
|
8
8
|
import { Coordinate } from '../utils/coordinate.js';
|
|
9
9
|
export declare class WorkspaceComment {
|
|
10
|
-
|
|
10
|
+
readonly workspace: Workspace;
|
|
11
11
|
/** The unique identifier for this comment. */
|
|
12
12
|
readonly id: string;
|
|
13
13
|
/** The text of the comment. */
|
|
@@ -23,7 +23,7 @@ export declare class WorkspaceComment {
|
|
|
23
23
|
/** Whether the comment is deletable or not. */
|
|
24
24
|
private deletable;
|
|
25
25
|
/** The location of the comment in workspace coordinates. */
|
|
26
|
-
|
|
26
|
+
protected location: Coordinate;
|
|
27
27
|
/** Whether this comment has been disposed or not. */
|
|
28
28
|
protected disposed: boolean;
|
|
29
29
|
/** Whether this comment is being disposed or not. */
|
|
@@ -36,6 +36,12 @@ export declare class WorkspaceComment {
|
|
|
36
36
|
* be generated.
|
|
37
37
|
*/
|
|
38
38
|
constructor(workspace: Workspace, id?: string);
|
|
39
|
+
private fireCreateEvent;
|
|
40
|
+
private fireDeleteEvent;
|
|
41
|
+
/** Fires a comment change event. */
|
|
42
|
+
private fireChangeEvent;
|
|
43
|
+
/** Fires a comment collapse event. */
|
|
44
|
+
private fireCollapseEvent;
|
|
39
45
|
/** Sets the text of the comment. */
|
|
40
46
|
setText(text: string): void;
|
|
41
47
|
/** Returns the text of the comment. */
|
|
@@ -85,7 +91,7 @@ export declare class WorkspaceComment {
|
|
|
85
91
|
*/
|
|
86
92
|
isOwnDeletable(): boolean;
|
|
87
93
|
/** Moves the comment to the given location in workspace coordinates. */
|
|
88
|
-
moveTo(location: Coordinate): void;
|
|
94
|
+
moveTo(location: Coordinate, reason?: string[] | undefined): void;
|
|
89
95
|
/** Returns the position of the comment in workspace coordinates. */
|
|
90
96
|
getRelativeToSurfaceXY(): Coordinate;
|
|
91
97
|
/** Disposes of this comment. */
|
package/core/connection.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
111
111
|
* Connect this connection to another connection.
|
|
112
112
|
*
|
|
113
113
|
* @param otherConnection Connection to connect to.
|
|
114
|
-
* @returns Whether the
|
|
114
|
+
* @returns Whether the blocks are now connected or not.
|
|
115
115
|
*/
|
|
116
116
|
connect(otherConnection: Connection): boolean;
|
|
117
117
|
/**
|
package/core/delete_area.d.ts
CHANGED
|
@@ -34,11 +34,10 @@ export declare class DeleteArea extends DragTarget implements IDeleteArea {
|
|
|
34
34
|
* before onDragEnter/onDragOver/onDragExit.
|
|
35
35
|
*
|
|
36
36
|
* @param element The block or bubble currently being dragged.
|
|
37
|
-
* @param couldConnect Whether the element could could connect to another.
|
|
38
37
|
* @returns Whether the element provided would be deleted if dropped on this
|
|
39
38
|
* area.
|
|
40
39
|
*/
|
|
41
|
-
wouldDelete(element: IDraggable
|
|
40
|
+
wouldDelete(element: IDraggable): boolean;
|
|
42
41
|
/**
|
|
43
42
|
* Updates the internal wouldDelete_ state.
|
|
44
43
|
*
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { BlockSvg } from '../block_svg.js';
|
|
9
|
+
export declare class BlockDragStrategy implements IDragStrategy {
|
|
10
|
+
private block;
|
|
11
|
+
private workspace;
|
|
12
|
+
/** The parent block at the start of the drag. */
|
|
13
|
+
private startParentConn;
|
|
14
|
+
/**
|
|
15
|
+
* The child block at the start of the drag. Only gets set if
|
|
16
|
+
* `healStack` is true.
|
|
17
|
+
*/
|
|
18
|
+
private startChildConn;
|
|
19
|
+
private startLoc;
|
|
20
|
+
private connectionCandidate;
|
|
21
|
+
private connectionPreviewer;
|
|
22
|
+
private dragging;
|
|
23
|
+
/**
|
|
24
|
+
* If this is a shadow block, the offset between this block and the parent
|
|
25
|
+
* block, to add to the drag location. In workspace units.
|
|
26
|
+
*/
|
|
27
|
+
private dragOffset;
|
|
28
|
+
constructor(block: BlockSvg);
|
|
29
|
+
/** Returns true if the block is currently movable. False otherwise. */
|
|
30
|
+
isMovable(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Handles any setup for starting the drag, including disconnecting the block
|
|
33
|
+
* from any parent blocks.
|
|
34
|
+
*/
|
|
35
|
+
startDrag(e?: PointerEvent): void;
|
|
36
|
+
/** Starts a drag on a shadow, recording the drag offset. */
|
|
37
|
+
private startDraggingShadow;
|
|
38
|
+
/**
|
|
39
|
+
* Whether or not we should disconnect the block when a drag is started.
|
|
40
|
+
*
|
|
41
|
+
* @param healStack Whether or not to heal the stack after disconnecting.
|
|
42
|
+
* @returns True to disconnect the block, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
private shouldDisconnect;
|
|
45
|
+
/**
|
|
46
|
+
* Disconnects the block from any parents. If `healStack` is true and this is
|
|
47
|
+
* a stack block, we also disconnect from any next blocks and attempt to
|
|
48
|
+
* attach them to any parent.
|
|
49
|
+
*
|
|
50
|
+
* @param healStack Whether or not to heal the stack after disconnecting.
|
|
51
|
+
*/
|
|
52
|
+
private disconnectBlock;
|
|
53
|
+
/** Fire a UI event at the start of a block drag. */
|
|
54
|
+
private fireDragStartEvent;
|
|
55
|
+
/** Fire a UI event at the end of a block drag. */
|
|
56
|
+
private fireDragEndEvent;
|
|
57
|
+
/** Fire a move event at the end of a block drag. */
|
|
58
|
+
private fireMoveEvent;
|
|
59
|
+
/** Moves the block and updates any connection previews. */
|
|
60
|
+
drag(newLoc: Coordinate): void;
|
|
61
|
+
/**
|
|
62
|
+
* @param draggingBlock The block being dragged.
|
|
63
|
+
* @param delta How far the pointer has moved from the position
|
|
64
|
+
* at the start of the drag, in workspace units.
|
|
65
|
+
*/
|
|
66
|
+
private updateConnectionPreview;
|
|
67
|
+
/**
|
|
68
|
+
* Returns true if the given orphan block can connect at the end of the
|
|
69
|
+
* top block's stack or row, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
private orphanCanConnectAtEnd;
|
|
72
|
+
/**
|
|
73
|
+
* Returns true if the current candidate is better than the new candidate.
|
|
74
|
+
*
|
|
75
|
+
* We slightly prefer the current candidate even if it is farther away.
|
|
76
|
+
*/
|
|
77
|
+
private currCandidateIsBetter;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the closest valid candidate connection, if one can be found.
|
|
80
|
+
*
|
|
81
|
+
* Valid neighbour connections are within the configured start radius, with a
|
|
82
|
+
* compatible type (input, output, etc) and connection check.
|
|
83
|
+
*/
|
|
84
|
+
private getConnectionCandidate;
|
|
85
|
+
/**
|
|
86
|
+
* Returns all of the connections we might connect to blocks on the workspace.
|
|
87
|
+
*
|
|
88
|
+
* Includes any connections on the dragging block, and any last next
|
|
89
|
+
* connection on the stack (if one exists).
|
|
90
|
+
*/
|
|
91
|
+
private getLocalConnections;
|
|
92
|
+
/**
|
|
93
|
+
* Cleans up any state at the end of the drag. Applies any pending
|
|
94
|
+
* connections.
|
|
95
|
+
*/
|
|
96
|
+
endDrag(e?: PointerEvent): void;
|
|
97
|
+
/** Connects the given candidate connections. */
|
|
98
|
+
private applyConnections;
|
|
99
|
+
/**
|
|
100
|
+
* Moves the block back to where it was at the beginning of the drag,
|
|
101
|
+
* including reconnecting connections.
|
|
102
|
+
*/
|
|
103
|
+
revertDrag(): void;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=block_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { IBubble, WorkspaceSvg } from '../blockly.js';
|
|
9
|
+
export declare class BubbleDragStrategy implements IDragStrategy {
|
|
10
|
+
private bubble;
|
|
11
|
+
private workspace;
|
|
12
|
+
private startLoc;
|
|
13
|
+
constructor(bubble: IBubble, workspace: WorkspaceSvg);
|
|
14
|
+
isMovable(): boolean;
|
|
15
|
+
startDrag(): void;
|
|
16
|
+
drag(newLoc: Coordinate): void;
|
|
17
|
+
endDrag(): void;
|
|
18
|
+
revertDrag(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=bubble_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { RenderedWorkspaceComment } from '../comments.js';
|
|
9
|
+
export declare class CommentDragStrategy implements IDragStrategy {
|
|
10
|
+
private comment;
|
|
11
|
+
private startLoc;
|
|
12
|
+
private workspace;
|
|
13
|
+
constructor(comment: RenderedWorkspaceComment);
|
|
14
|
+
isMovable(): boolean;
|
|
15
|
+
startDrag(): void;
|
|
16
|
+
drag(newLoc: Coordinate): void;
|
|
17
|
+
endDrag(): void;
|
|
18
|
+
revertDrag(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=comment_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDeletable } from '../interfaces/i_deletable.js';
|
|
7
|
+
import { IDragger } from '../interfaces/i_dragger.js';
|
|
8
|
+
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
9
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
10
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
11
|
+
export declare class Dragger implements IDragger {
|
|
12
|
+
private draggable;
|
|
13
|
+
private workspace;
|
|
14
|
+
private startLoc;
|
|
15
|
+
private dragTarget;
|
|
16
|
+
constructor(draggable: IDraggable, workspace: WorkspaceSvg);
|
|
17
|
+
/** Handles any drag startup. */
|
|
18
|
+
onDragStart(e: PointerEvent): void;
|
|
19
|
+
/**
|
|
20
|
+
* Handles calculating where the element should actually be moved to.
|
|
21
|
+
*
|
|
22
|
+
* @param totalDelta The total amount in pixel coordinates the mouse has moved
|
|
23
|
+
* since the start of the drag.
|
|
24
|
+
*/
|
|
25
|
+
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
26
|
+
/** Updates the drag target under the pointer (if there is one). */
|
|
27
|
+
protected updateDragTarget(e: PointerEvent): void;
|
|
28
|
+
/**
|
|
29
|
+
* Calculates the correct workspace coordinate for the movable and tells
|
|
30
|
+
* the draggable to go to that location.
|
|
31
|
+
*/
|
|
32
|
+
private moveDraggable;
|
|
33
|
+
/**
|
|
34
|
+
* Returns true if we would delete the draggable if it was dropped
|
|
35
|
+
* at the current location.
|
|
36
|
+
*/
|
|
37
|
+
protected wouldDeleteDraggable(e: PointerEvent, draggable: IDraggable & IDeletable): boolean;
|
|
38
|
+
/** Handles any drag cleanup. */
|
|
39
|
+
onDragEnd(e: PointerEvent): void;
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if we should return the draggable to its original location
|
|
42
|
+
* at the end of the drag.
|
|
43
|
+
*/
|
|
44
|
+
protected shouldReturnToStart(e: PointerEvent, draggable: IDraggable): boolean;
|
|
45
|
+
protected pixelsToWorkspaceUnits(pixelCoord: Coordinate): Coordinate;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=dragger.d.ts.map
|
package/core/events/events.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { CommentChange, CommentChangeJson } from './events_comment_change.js';
|
|
|
18
18
|
import { CommentCreate, CommentCreateJson } from './events_comment_create.js';
|
|
19
19
|
import { CommentDelete } from './events_comment_delete.js';
|
|
20
20
|
import { CommentMove, CommentMoveJson } from './events_comment_move.js';
|
|
21
|
+
import { CommentCollapse, CommentCollapseJson } from './events_comment_collapse.js';
|
|
21
22
|
import { MarkerMove, MarkerMoveJson } from './events_marker_move.js';
|
|
22
23
|
import { Selected, SelectedJson } from './events_selected.js';
|
|
23
24
|
import { ThemeChange, ThemeChangeJson } from './events_theme_change.js';
|
|
@@ -62,6 +63,8 @@ export { CommentCreateJson };
|
|
|
62
63
|
export { CommentDelete };
|
|
63
64
|
export { CommentMove };
|
|
64
65
|
export { CommentMoveJson };
|
|
66
|
+
export { CommentCollapse };
|
|
67
|
+
export { CommentCollapseJson };
|
|
65
68
|
export { FinishedLoading };
|
|
66
69
|
export { MarkerMove };
|
|
67
70
|
export { MarkerMoveJson };
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Base class for comment events.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
12
|
import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
|
|
8
13
|
import type { CommentCreate } from './events_comment_create.js';
|
|
9
14
|
import type { CommentDelete } from './events_comment_delete.js';
|