blockly 11.0.0-beta.6 → 11.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/blockly.min.js +361 -346
  2. package/blockly_compressed.js +350 -335
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +1 -1
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +2 -3
  7. package/core/block_svg.d.ts +23 -10
  8. package/core/blockly.d.ts +16 -15
  9. package/core/bubbles/bubble.d.ts +17 -2
  10. package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
  11. package/core/bubbles/text_bubble.d.ts +1 -1
  12. package/core/bubbles/textinput_bubble.d.ts +1 -1
  13. package/core/comments/comment_view.d.ts +15 -1
  14. package/core/comments/rendered_workspace_comment.d.ts +43 -3
  15. package/core/comments/workspace_comment.d.ts +9 -3
  16. package/core/connection.d.ts +1 -1
  17. package/core/delete_area.d.ts +1 -2
  18. package/core/dragging/block_drag_strategy.d.ts +105 -0
  19. package/core/dragging/bubble_drag_strategy.d.ts +20 -0
  20. package/core/dragging/comment_drag_strategy.d.ts +20 -0
  21. package/core/dragging/dragger.d.ts +48 -0
  22. package/core/dragging.d.ts +11 -0
  23. package/core/events/events.d.ts +3 -0
  24. package/core/events/events_comment_base.d.ts +6 -1
  25. package/core/events/events_comment_change.d.ts +1 -1
  26. package/core/events/events_comment_collapse.d.ts +39 -0
  27. package/core/events/events_comment_create.d.ts +5 -1
  28. package/core/events/events_comment_delete.d.ts +5 -1
  29. package/core/events/events_comment_move.d.ts +17 -1
  30. package/core/events/utils.d.ts +2 -0
  31. package/core/flyout_base.d.ts +17 -1
  32. package/core/flyout_button.d.ts +26 -1
  33. package/core/gesture.d.ts +27 -53
  34. package/core/icons/comment_icon.d.ts +5 -0
  35. package/core/interfaces/i_comment_icon.d.ts +5 -1
  36. package/core/interfaces/i_deletable.d.ts +6 -0
  37. package/core/interfaces/i_delete_area.d.ts +1 -2
  38. package/core/interfaces/i_draggable.d.ts +47 -3
  39. package/core/interfaces/i_dragger.d.ts +32 -0
  40. package/core/interfaces/i_selectable.d.ts +5 -3
  41. package/core/internal_constants.d.ts +0 -7
  42. package/core/keyboard_nav/ast_node.d.ts +21 -2
  43. package/core/registry.d.ts +6 -2
  44. package/core/renderers/common/marker_svg.d.ts +7 -0
  45. package/core/toolbox/toolbox.d.ts +1 -2
  46. package/core/workspace_comment_svg.d.ts +1 -2
  47. package/core/workspace_svg.d.ts +0 -2
  48. package/core/xml.d.ts +5 -0
  49. package/dart_compressed.js +8 -8
  50. package/dart_compressed.js.map +1 -1
  51. package/javascript_compressed.js +10 -10
  52. package/javascript_compressed.js.map +1 -1
  53. package/lua_compressed.js +6 -7
  54. package/lua_compressed.js.map +1 -1
  55. package/media/delete-icon.svg +1 -0
  56. package/package.json +2 -2
  57. package/php_compressed.js +7 -7
  58. package/php_compressed.js.map +1 -1
  59. package/python_compressed.js +3 -3
  60. package/python_compressed.js.map +1 -1
  61. package/core/block_dragger.d.ts +0 -212
  62. package/core/bubble_dragger.d.ts +0 -77
  63. package/core/interfaces/i_block_dragger.d.ts +0 -47
  64. /package/media/{arrow-dropdown.svg → foldout-icon.svg} +0 -0
@@ -1,212 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * Methods for dragging a block visually.
8
- *
9
- * @class
10
- */
11
- import './events/events_block_drag.js';
12
- import type { BlockSvg } from './block_svg.js';
13
- import type { Icon } from './icons/icon.js';
14
- import type { IBlockDragger } from './interfaces/i_block_dragger.js';
15
- import { Coordinate } from './utils/coordinate.js';
16
- import type { WorkspaceSvg } from './workspace_svg.js';
17
- import { IConnectionPreviewer } from './blockly.js';
18
- /**
19
- * Class for a block dragger. It moves blocks around the workspace when they
20
- * are being dragged by a mouse or touch.
21
- */
22
- export declare class BlockDragger implements IBlockDragger {
23
- /** The top block in the stack that is being dragged. */
24
- protected draggingBlock_: BlockSvg;
25
- protected connectionPreviewer: IConnectionPreviewer;
26
- /** The workspace on which the block is being dragged. */
27
- protected workspace_: WorkspaceSvg;
28
- /** Which drag area the mouse pointer is over, if any. */
29
- private dragTarget_;
30
- private connectionCandidate;
31
- /** Whether the block would be deleted if dropped immediately. */
32
- protected wouldDeleteBlock_: boolean;
33
- protected startXY_: Coordinate;
34
- /** The parent block at the start of the drag. */
35
- private startParentConn;
36
- /**
37
- * The child block at the start of the drag. Only gets set if
38
- * `healStack` is true.
39
- */
40
- private startChildConn;
41
- /**
42
- * @param block The block to drag.
43
- * @param workspace The workspace to drag on.
44
- */
45
- constructor(block: BlockSvg, workspace: WorkspaceSvg);
46
- /**
47
- * Sever all links from this object.
48
- *
49
- * @internal
50
- */
51
- dispose(): void;
52
- /**
53
- * Start dragging a block.
54
- *
55
- * @param currentDragDeltaXY How far the pointer has moved from the position
56
- * at mouse down, in pixel units.
57
- * @param healStack Whether or not to heal the stack after disconnecting.
58
- */
59
- startDrag(currentDragDeltaXY: Coordinate, healStack: boolean): void;
60
- /**
61
- * Whether or not we should disconnect the block when a drag is started.
62
- *
63
- * @param healStack Whether or not to heal the stack after disconnecting.
64
- * @returns True to disconnect the block, false otherwise.
65
- */
66
- protected shouldDisconnect_(healStack: boolean): boolean;
67
- /**
68
- * Disconnects the block and moves it to a new location.
69
- *
70
- * @param healStack Whether or not to heal the stack after disconnecting.
71
- * @param currentDragDeltaXY How far the pointer has moved from the position
72
- * at mouse down, in pixel units.
73
- */
74
- protected disconnectBlock_(healStack: boolean, currentDragDeltaXY: Coordinate): void;
75
- /** Fire a UI event at the start of a block drag. */
76
- protected fireDragStartEvent_(): void;
77
- /**
78
- * Execute a step of block dragging, based on the given event. Update the
79
- * display accordingly.
80
- *
81
- * @param e The most recent move event.
82
- * @param delta How far the pointer has moved from the position
83
- * at the start of the drag, in pixel units.
84
- */
85
- drag(e: PointerEvent, delta: Coordinate): void;
86
- /**
87
- * @param draggingBlock The block being dragged.
88
- * @param dragDelta How far the pointer has moved from the position
89
- * at the start of the drag, in pixel units.
90
- */
91
- private moveBlock;
92
- private updateDragTargets;
93
- /**
94
- * Returns true if we would delete the block if it was dropped at this time,
95
- * false otherwise.
96
- *
97
- * @param e The most recent move event.
98
- * @param draggingBlock The block being dragged.
99
- * @param delta How far the pointer has moved from the position
100
- * at the start of the drag, in pixel units.
101
- */
102
- private wouldDeleteBlock;
103
- /**
104
- * @param draggingBlock The block being dragged.
105
- * @param dragDelta How far the pointer has moved from the position
106
- * at the start of the drag, in pixel units.
107
- */
108
- private updateConnectionPreview;
109
- /**
110
- * Returns true if the given orphan block can connect at the end of the
111
- * top block's stack or row, false otherwise.
112
- */
113
- private orphanCanConnectAtEnd;
114
- /**
115
- * Returns true if the current candidate is better than the new candidate.
116
- *
117
- * We slightly prefer the current candidate even if it is farther away.
118
- */
119
- private currCandidateIsBetter;
120
- /**
121
- * Returns the closest valid candidate connection, if one can be found.
122
- *
123
- * Valid neighbour connections are within the configured start radius, with a
124
- * compatible type (input, output, etc) and connection check.
125
- */
126
- private getConnectionCandidate;
127
- /**
128
- * Returns all of the connections we might connect to blocks on the workspace.
129
- *
130
- * Includes any connections on the dragging block, and any last next
131
- * connection on the stack (if one exists).
132
- */
133
- private getLocalConnections;
134
- /**
135
- * Finish a block drag and put the block back on the workspace.
136
- *
137
- * @param e The pointerup event.
138
- * @param currentDragDeltaXY How far the pointer has moved from the position
139
- * at the start of the drag, in pixel units.
140
- */
141
- endDrag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
142
- /**
143
- * Moves the dragged block back to its original position before the start of
144
- * the drag. Reconnects any parent and child blocks.
145
- */
146
- private moveToOriginalPosition;
147
- /**
148
- * Calculates the drag delta and new location values after a block is dragged.
149
- *
150
- * @param currentDragDeltaXY How far the pointer has moved from the start of
151
- * the drag, in pixel units.
152
- * @returns New location after drag. delta is in workspace units. newLocation
153
- * is the new coordinate where the block should end up.
154
- */
155
- protected getNewLocationAfterDrag_(currentDragDeltaXY: Coordinate): {
156
- delta: Coordinate;
157
- newLocation: Coordinate;
158
- };
159
- /**
160
- * May delete the dragging block, if allowed. If `this.wouldDeleteBlock_` is
161
- * not true, the block will not be deleted. This should be called at the end
162
- * of a block drag.
163
- *
164
- * @returns True if the block was deleted.
165
- */
166
- protected maybeDeleteBlock_(): boolean;
167
- /**
168
- * Updates the necessary information to place a block at a certain location.
169
- */
170
- protected updateBlockAfterMove_(): void;
171
- private applyConnections;
172
- /** Fire a UI event at the end of a block drag. */
173
- protected fireDragEndEvent_(): void;
174
- /**
175
- * Adds or removes the style of the cursor for the toolbox.
176
- * This is what changes the cursor to display an x when a deletable block is
177
- * held over the toolbox.
178
- *
179
- * @param isEnd True if we are at the end of a drag, false otherwise.
180
- */
181
- protected updateToolboxStyle_(isEnd: boolean): void;
182
- /** Fire a move event at the end of a block drag. */
183
- protected fireMoveEvent_(): void;
184
- /**
185
- * Update the cursor (and possibly the trash can lid) to reflect whether the
186
- * dragging block would be deleted if released immediately.
187
- */
188
- protected updateCursorDuringBlockDrag_(): void;
189
- /**
190
- * Convert a coordinate object from pixels to workspace units, including a
191
- * correction for mutator workspaces.
192
- * This function does not consider differing origins. It simply scales the
193
- * input's x and y values.
194
- *
195
- * @param pixelCoord A coordinate with x and y values in CSS pixel units.
196
- * @returns The input coordinate divided by the workspace scale.
197
- */
198
- protected pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate;
199
- /**
200
- * Get a list of the insertion markers that currently exist. Drags have 0, 1,
201
- * or 2 insertion markers.
202
- *
203
- * @returns A possibly empty list of insertion marker blocks.
204
- */
205
- getInsertionMarkers(): BlockSvg[];
206
- }
207
- /** Data about the position of a given icon. */
208
- export interface IconPositionData {
209
- location: Coordinate;
210
- icon: Icon;
211
- }
212
- //# sourceMappingURL=block_dragger.d.ts.map
@@ -1,77 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IBubble } from './interfaces/i_bubble.js';
7
- import { Coordinate } from './utils/coordinate.js';
8
- import type { WorkspaceSvg } from './workspace_svg.js';
9
- /**
10
- * Class for a bubble dragger. It moves things on the bubble canvas around the
11
- * workspace when they are being dragged by a mouse or touch. These can be
12
- * block comments, mutators, warnings, or workspace comments.
13
- */
14
- export declare class BubbleDragger {
15
- private bubble;
16
- private workspace;
17
- /** Which drag target the mouse pointer is over, if any. */
18
- private dragTarget_;
19
- /** Whether the bubble would be deleted if dropped immediately. */
20
- private wouldDeleteBubble_;
21
- private readonly startXY_;
22
- /**
23
- * @param bubble The item on the bubble canvas to drag.
24
- * @param workspace The workspace to drag on.
25
- */
26
- constructor(bubble: IBubble, workspace: WorkspaceSvg);
27
- /**
28
- * Start dragging a bubble.
29
- *
30
- * @internal
31
- */
32
- startBubbleDrag(): void;
33
- /**
34
- * Execute a step of bubble dragging, based on the given event. Update the
35
- * display accordingly.
36
- *
37
- * @param e The most recent move event.
38
- * @param currentDragDeltaXY How far the pointer has moved from the position
39
- * at the start of the drag, in pixel units.
40
- * @internal
41
- */
42
- dragBubble(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
43
- /**
44
- * Whether ending the drag would delete the bubble.
45
- *
46
- * @param dragTarget The drag target that the bubblee is currently over.
47
- * @returns Whether dropping the bubble immediately would delete the block.
48
- */
49
- private shouldDelete_;
50
- /**
51
- * Update the cursor (and possibly the trash can lid) to reflect whether the
52
- * dragging bubble would be deleted if released immediately.
53
- */
54
- private updateCursorDuringBubbleDrag_;
55
- /**
56
- * Finish a bubble drag and put the bubble back on the workspace.
57
- *
58
- * @param e The pointerup event.
59
- * @param currentDragDeltaXY How far the pointer has moved from the position
60
- * at the start of the drag, in pixel units.
61
- * @internal
62
- */
63
- endBubbleDrag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
64
- /** Fire a move event at the end of a bubble drag. */
65
- private fireMoveEvent_;
66
- /**
67
- * Convert a coordinate object from pixels to workspace units, including a
68
- * correction for mutator workspaces.
69
- * This function does not consider differing origins. It simply scales the
70
- * input's x and y values.
71
- *
72
- * @param pixelCoord A coordinate with x and y values in CSS pixel units.
73
- * @returns The input coordinate divided by the workspace scale.
74
- */
75
- private pixelsToWorkspaceUnits_;
76
- }
77
- //# sourceMappingURL=bubble_dragger.d.ts.map
@@ -1,47 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Coordinate } from '../utils/coordinate.js';
7
- import type { BlockSvg } from '../block_svg.js';
8
- /**
9
- * A block dragger interface.
10
- */
11
- export interface IBlockDragger {
12
- /**
13
- * Start dragging a block.
14
- *
15
- * @param currentDragDeltaXY How far the pointer has moved from the position
16
- * at mouse down, in pixel units.
17
- * @param healStack Whether or not to heal the stack after disconnecting.
18
- */
19
- startDrag(currentDragDeltaXY: Coordinate, healStack: boolean): void;
20
- /**
21
- * Execute a step of block dragging, based on the given event. Update the
22
- * display accordingly.
23
- *
24
- * @param e The most recent move event.
25
- * @param currentDragDeltaXY How far the pointer has moved from the position
26
- * at the start of the drag, in pixel units.
27
- */
28
- drag(e: Event, currentDragDeltaXY: Coordinate): void;
29
- /**
30
- * Finish a block drag and put the block back on the workspace.
31
- *
32
- * @param e The mouseup/touchend event.
33
- * @param currentDragDeltaXY How far the pointer has moved from the position
34
- * at the start of the drag, in pixel units.
35
- */
36
- endDrag(e: Event, currentDragDeltaXY: Coordinate): void;
37
- /**
38
- * Get a list of the insertion markers that currently exist. Drags have 0, 1,
39
- * or 2 insertion markers.
40
- *
41
- * @returns A possibly empty list of insertion marker blocks.
42
- */
43
- getInsertionMarkers(): BlockSvg[];
44
- /** Sever all links from this object and do any necessary cleanup. */
45
- dispose(): void;
46
- }
47
- //# sourceMappingURL=i_block_dragger.d.ts.map
File without changes