blockly 11.0.0-beta.3 → 11.0.0-beta.5

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 (69) hide show
  1. package/blockly.min.js +504 -474
  2. package/blockly_compressed.js +494 -464
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +10 -10
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +1 -8
  7. package/core/block_dragger.d.ts +66 -4
  8. package/core/block_svg.d.ts +32 -5
  9. package/core/blockly.d.ts +35 -0
  10. package/core/clipboard.d.ts +19 -0
  11. package/core/connection_previewers/insertion_marker_previewer.d.ts +56 -0
  12. package/core/gesture.d.ts +0 -2
  13. package/core/grid.d.ts +24 -3
  14. package/core/icons/comment_icon.d.ts +2 -2
  15. package/core/icons/icon.d.ts +6 -0
  16. package/core/icons/mutator_icon.d.ts +16 -1
  17. package/core/icons/warning_icon.d.ts +1 -1
  18. package/core/inputs/input.d.ts +19 -10
  19. package/core/insertion_marker_manager.d.ts +2 -0
  20. package/core/interfaces/i_connection_previewer.d.ts +39 -0
  21. package/core/interfaces/i_has_bubble.d.ts +1 -1
  22. package/core/interfaces/i_parameter_model.d.ts +0 -7
  23. package/core/interfaces/i_procedure_model.d.ts +0 -7
  24. package/core/options.d.ts +0 -1
  25. package/core/registry.d.ts +4 -2
  26. package/core/render_management.d.ts +4 -1
  27. package/core/rendered_connection.d.ts +3 -1
  28. package/core/renderers/common/constants.d.ts +6 -2
  29. package/core/renderers/common/drawer.d.ts +25 -0
  30. package/core/renderers/common/i_path_object.d.ts +6 -15
  31. package/core/renderers/common/info.d.ts +5 -2
  32. package/core/renderers/common/path_object.d.ts +13 -0
  33. package/core/renderers/common/renderer.d.ts +3 -0
  34. package/core/renderers/measurables/connection.d.ts +1 -0
  35. package/core/renderers/measurables/icon.d.ts +5 -0
  36. package/core/renderers/minimalist/constants.d.ts +21 -0
  37. package/core/renderers/minimalist/drawer.d.ts +26 -0
  38. package/core/renderers/minimalist/info.d.ts +35 -0
  39. package/core/renderers/minimalist/minimalist.d.ts +12 -0
  40. package/core/renderers/minimalist/renderer.d.ts +48 -0
  41. package/core/renderers/zelos/drawer.d.ts +4 -0
  42. package/core/renderers/zelos/renderer.d.ts +4 -2
  43. package/core/serialization/procedures.d.ts +26 -28
  44. package/core/utils/dom.d.ts +9 -0
  45. package/core/utils/string.d.ts +10 -0
  46. package/core/workspace_audio.d.ts +10 -0
  47. package/core/workspace_svg.d.ts +27 -1
  48. package/dart.d.ts +24 -1
  49. package/javascript.d.ts +41 -1
  50. package/lua.d.ts +18 -1
  51. package/msg/ar.js +1 -1
  52. package/msg/be-tarask.js +8 -8
  53. package/msg/bn.js +5 -5
  54. package/msg/da.js +4 -4
  55. package/msg/el.js +1 -1
  56. package/msg/he.js +1 -1
  57. package/msg/id.js +6 -6
  58. package/msg/inh.js +3 -3
  59. package/msg/ja.js +1 -1
  60. package/msg/nl.js +3 -3
  61. package/msg/pt.js +1 -1
  62. package/msg/ta.js +2 -2
  63. package/msg/tl.js +2 -2
  64. package/msg/ur.js +2 -2
  65. package/msg/zh-hant.js +14 -14
  66. package/package.json +5 -8
  67. package/php.d.ts +43 -1
  68. package/python.d.ts +27 -1
  69. package/msg/yue.js +0 -441
package/core/block.d.ts CHANGED
@@ -139,12 +139,6 @@ export declare class Block implements IASTNodeLocation, IDeletable {
139
139
  * Is the current block currently in the process of being disposed?
140
140
  */
141
141
  private disposing;
142
- /**
143
- * Has this block been fully initialized? E.g. all fields initailized.
144
- *
145
- * @internal
146
- */
147
- initialized: boolean;
148
142
  private readonly xy_;
149
143
  isInFlyout: boolean;
150
144
  isInMutator: boolean;
@@ -153,8 +147,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
153
147
  protected isInsertionMarker_: boolean;
154
148
  /** Name of the type of hat. */
155
149
  hat?: string;
156
- /** Is this block a BlockSVG? */
157
- readonly rendered: boolean;
150
+ rendered: boolean | null;
158
151
  /**
159
152
  * String for block help, or function that returns a URL. Null for no help.
160
153
  */
@@ -11,10 +11,10 @@
11
11
  import './events/events_block_drag.js';
12
12
  import type { BlockSvg } from './block_svg.js';
13
13
  import type { Icon } from './icons/icon.js';
14
- import { InsertionMarkerManager } from './insertion_marker_manager.js';
15
14
  import type { IBlockDragger } from './interfaces/i_block_dragger.js';
16
15
  import { Coordinate } from './utils/coordinate.js';
17
16
  import type { WorkspaceSvg } from './workspace_svg.js';
17
+ import { IConnectionPreviewer } from './blockly.js';
18
18
  /**
19
19
  * Class for a block dragger. It moves blocks around the workspace when they
20
20
  * are being dragged by a mouse or touch.
@@ -22,14 +22,20 @@ import type { WorkspaceSvg } from './workspace_svg.js';
22
22
  export declare class BlockDragger implements IBlockDragger {
23
23
  /** The top block in the stack that is being dragged. */
24
24
  protected draggingBlock_: BlockSvg;
25
- protected draggedConnectionManager_: InsertionMarkerManager;
25
+ protected connectionPreviewer: IConnectionPreviewer;
26
26
  /** The workspace on which the block is being dragged. */
27
27
  protected workspace_: WorkspaceSvg;
28
28
  /** Which drag area the mouse pointer is over, if any. */
29
29
  private dragTarget_;
30
+ private connectionCandidate;
30
31
  /** Whether the block would be deleted if dropped immediately. */
31
32
  protected wouldDeleteBlock_: boolean;
32
33
  protected startXY_: Coordinate;
34
+ /**
35
+ * @deprecated To be removed in v11. Updating icons is now handled by the
36
+ * block's `moveDuringDrag` method.
37
+ */
38
+ protected dragIconData_: IconPositionData[];
33
39
  /**
34
40
  * @param block The block to drag.
35
41
  * @param workspace The workspace to drag on.
@@ -71,10 +77,58 @@ export declare class BlockDragger implements IBlockDragger {
71
77
  * display accordingly.
72
78
  *
73
79
  * @param e The most recent move event.
74
- * @param currentDragDeltaXY How far the pointer has moved from the position
80
+ * @param delta How far the pointer has moved from the position
81
+ * at the start of the drag, in pixel units.
82
+ */
83
+ drag(e: PointerEvent, delta: Coordinate): void;
84
+ /**
85
+ * @param draggingBlock The block being dragged.
86
+ * @param dragDelta How far the pointer has moved from the position
87
+ * at the start of the drag, in pixel units.
88
+ */
89
+ private moveBlock;
90
+ private updateDragTargets;
91
+ /**
92
+ * Returns true if we would delete the block if it was dropped at this time,
93
+ * false otherwise.
94
+ *
95
+ * @param e The most recent move event.
96
+ * @param draggingBlock The block being dragged.
97
+ * @param delta How far the pointer has moved from the position
98
+ * at the start of the drag, in pixel units.
99
+ */
100
+ private wouldDeleteBlock;
101
+ /**
102
+ * @param draggingBlock The block being dragged.
103
+ * @param dragDelta How far the pointer has moved from the position
75
104
  * at the start of the drag, in pixel units.
76
105
  */
77
- drag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
106
+ private updateConnectionPreview;
107
+ /**
108
+ * Returns true if the given orphan block can connect at the end of the
109
+ * top block's stack or row, false otherwise.
110
+ */
111
+ private orphanCanConnectAtEnd;
112
+ /**
113
+ * Returns true if the current candidate is better than the new candidate.
114
+ *
115
+ * We slightly prefer the current candidate even if it is farther away.
116
+ */
117
+ private currCandidateIsBetter;
118
+ /**
119
+ * Returns the closest valid candidate connection, if one can be found.
120
+ *
121
+ * Valid neighbour connections are within the configured start radius, with a
122
+ * compatible type (input, output, etc) and connection check.
123
+ */
124
+ private getConnectionCandidate;
125
+ /**
126
+ * Returns all of the connections we might connect to blocks on the workspace.
127
+ *
128
+ * Includes any connections on the dragging block, and any last next
129
+ * connection on the stack (if one exists).
130
+ */
131
+ private getLocalConnections;
78
132
  /**
79
133
  * Finish a block drag and put the block back on the workspace.
80
134
  *
@@ -107,6 +161,7 @@ export declare class BlockDragger implements IBlockDragger {
107
161
  * Updates the necessary information to place a block at a certain location.
108
162
  */
109
163
  protected updateBlockAfterMove_(): void;
164
+ private applyConnections;
110
165
  /** Fire a UI event at the end of a block drag. */
111
166
  protected fireDragEndEvent_(): void;
112
167
  /**
@@ -134,6 +189,13 @@ export declare class BlockDragger implements IBlockDragger {
134
189
  * @returns The input coordinate divided by the workspace scale.
135
190
  */
136
191
  protected pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate;
192
+ /**
193
+ * Move all of the icons connected to this drag.
194
+ *
195
+ * @deprecated To be removed in v11. This is now handled by the block's
196
+ * `moveDuringDrag` method.
197
+ */
198
+ protected dragIcons_(): void;
137
199
  /**
138
200
  * Get a list of the insertion markers that currently exist. Drags have 0, 1,
139
201
  * or 2 insertion markers.
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import './events/events_selected.js';
12
12
  import { Block } from './block.js';
13
+ import { CommentIcon } from './icons/comment_icon.js';
13
14
  import type { Connection } from './connection.js';
14
15
  import { ConnectionType } from './connection_type.js';
15
16
  import { ContextMenuOption, LegacyContextMenuOption } from './contextmenu_registry.js';
@@ -26,6 +27,7 @@ import type { IPathObject } from './renderers/common/i_path_object.js';
26
27
  import type { BlockStyle } from './theme.js';
27
28
  import { Coordinate } from './utils/coordinate.js';
28
29
  import { Rect } from './utils/rect.js';
30
+ import { WarningIcon } from './icons/warning_icon.js';
29
31
  import type { Workspace } from './workspace.js';
30
32
  import type { WorkspaceSvg } from './workspace_svg.js';
31
33
  import { IconType } from './icons/icon_types.js';
@@ -66,12 +68,17 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
66
68
  private warningTextDb;
67
69
  /** Block's mutator icon (if any). */
68
70
  mutator: MutatorIcon | null;
71
+ /**
72
+ * Block's warning icon (if any).
73
+ *
74
+ * @deprecated Use `setWarningText` to modify warnings on this block.
75
+ */
76
+ warning: WarningIcon | null;
69
77
  private svgGroup_;
70
78
  style: BlockStyle;
71
79
  /** @internal */
72
80
  pathObject: IPathObject;
73
- /** Is this block a BlockSVG? */
74
- readonly rendered = true;
81
+ rendered: boolean;
75
82
  private visuallyDisabled;
76
83
  /**
77
84
  * Is this block currently rendering? Used to stop recursive render calls
@@ -85,6 +92,11 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
85
92
  nextConnection: RenderedConnection;
86
93
  previousConnection: RenderedConnection;
87
94
  private translation;
95
+ /**
96
+ * The ID of the setTimeout callback for bumping neighbours, or 0 if no bump
97
+ * is currently scheduled.
98
+ */
99
+ private bumpNeighboursPid;
88
100
  /** Whether this block is currently being dragged. */
89
101
  private dragging;
90
102
  /**
@@ -337,6 +349,14 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
337
349
  * @internal
338
350
  */
339
351
  updateDisabled(): void;
352
+ /**
353
+ * Get the comment icon attached to this block, or null if the block has no
354
+ * comment.
355
+ *
356
+ * @returns The comment icon attached to this block, or null.
357
+ * @deprecated Use getIcon. To be remove in v11.
358
+ */
359
+ getCommentIcon(): CommentIcon | null;
340
360
  /**
341
361
  * Set this block's warning text.
342
362
  *
@@ -486,7 +506,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
486
506
  * Returns connections originating from this block.
487
507
  *
488
508
  * @param all If true, return all connections even hidden ones.
489
- * Otherwise, for a collapsed block don't return inputs connections.
509
+ * Otherwise, for a non-rendered block return an empty list, and for a
510
+ * collapsed block don't return inputs connections.
490
511
  * @returns Array of connections.
491
512
  * @internal
492
513
  */
@@ -541,8 +562,14 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
541
562
  */
542
563
  bumpNeighbours(): void;
543
564
  /**
544
- * Snap to grid, and then bump neighbouring blocks away at the end of the next
545
- * render.
565
+ * Bumps unconnected blocks out of alignment.
566
+ */
567
+ private bumpNeighboursInternal;
568
+ /**
569
+ * Schedule snapping to grid and bumping neighbours to occur after a brief
570
+ * delay.
571
+ *
572
+ * @internal
546
573
  */
547
574
  scheduleSnapAndBump(): void;
548
575
  /**
package/core/blockly.d.ts CHANGED
@@ -14,6 +14,7 @@ import { BlockSvg } from './block_svg.js';
14
14
  import { BlocklyOptions } from './blockly_options.js';
15
15
  import { Blocks } from './blocks.js';
16
16
  import * as browserEvents from './browser_events.js';
17
+ import { Bubble } from './bubbles/bubble.js';
17
18
  import * as bubbles from './bubbles.js';
18
19
  import { BubbleDragger } from './bubble_dragger.js';
19
20
  import * as bumpObjects from './bump_objects.js';
@@ -58,9 +59,12 @@ import { Gesture } from './gesture.js';
58
59
  import { Grid } from './grid.js';
59
60
  import * as icons from './icons.js';
60
61
  import { inject } from './inject.js';
62
+ import { Align } from './inputs/align.js';
61
63
  import { Input } from './inputs/input.js';
64
+ import { inputTypes } from './inputs/input_types.js';
62
65
  import * as inputs from './inputs.js';
63
66
  import { InsertionMarkerManager } from './insertion_marker_manager.js';
67
+ import { InsertionMarkerPreviewer } from './connection_previewers/insertion_marker_previewer.js';
64
68
  import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
65
69
  import { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
66
70
  import { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
@@ -71,6 +75,7 @@ import { IBubble } from './interfaces/i_bubble.js';
71
75
  import { ICollapsibleToolboxItem } from './interfaces/i_collapsible_toolbox_item.js';
72
76
  import { IComponent } from './interfaces/i_component.js';
73
77
  import { IConnectionChecker } from './interfaces/i_connection_checker.js';
78
+ import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
74
79
  import { IContextMenu } from './interfaces/i_contextmenu.js';
75
80
  import { ICopyable, isCopyable } from './interfaces/i_copyable.js';
76
81
  import { IDeletable } from './interfaces/i_deletable.js';
@@ -114,6 +119,7 @@ import * as renderManagement from './render_management.js';
114
119
  import * as blockRendering from './renderers/common/block_rendering.js';
115
120
  import * as constants from './constants.js';
116
121
  import * as geras from './renderers/geras/geras.js';
122
+ import * as minimalist from './renderers/minimalist/minimalist.js';
117
123
  import * as thrasos from './renderers/thrasos/thrasos.js';
118
124
  import * as zelos from './renderers/zelos/zelos.js';
119
125
  import { Scrollbar } from './scrollbar.js';
@@ -157,6 +163,21 @@ import { ZoomControls } from './zoom_controls.js';
157
163
  * @define {string}
158
164
  */
159
165
  export declare const VERSION = "uncompiled";
166
+ /**
167
+ * @see Blockly.Input.Align.LEFT
168
+ * @deprecated Use `Blockly.inputs.Align.LEFT`. To be removed in v11.
169
+ */
170
+ export declare const ALIGN_LEFT = Align.LEFT;
171
+ /**
172
+ * @see Blockly.Input.Align.CENTRE
173
+ * @deprecated Use `Blockly.inputs.Align.CENTER`. To be removed in v11.
174
+ */
175
+ export declare const ALIGN_CENTRE = Align.CENTRE;
176
+ /**
177
+ * @see Blockly.Input.Align.RIGHT
178
+ * @deprecated Use `Blockly.inputs.Align.RIGHT`. To be removed in v11.
179
+ */
180
+ export declare const ALIGN_RIGHT = Align.RIGHT;
160
181
  /**
161
182
  * @see ConnectionType.INPUT_VALUE
162
183
  */
@@ -173,6 +194,11 @@ export declare const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;
173
194
  * @see ConnectionType.PREVIOUS_STATEMENT
174
195
  */
175
196
  export declare const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT;
197
+ /**
198
+ * @see inputTypes.DUMMY_INPUT
199
+ * @deprecated Use `Blockly.inputs.inputTypes.DUMMY`. To be removed in v11.
200
+ */
201
+ export declare const DUMMY_INPUT = inputTypes.DUMMY;
176
202
  /** Aliases for toolbox positions. */
177
203
  /**
178
204
  * @see toolbox.Position.TOP
@@ -288,6 +314,7 @@ export { constants };
288
314
  export { dialog };
289
315
  export { fieldRegistry };
290
316
  export { geras };
317
+ export { minimalist };
291
318
  export { registry };
292
319
  export { thrasos };
293
320
  export { uiPosition };
@@ -301,6 +328,8 @@ export { BlockDragger };
301
328
  export { BlockSvg };
302
329
  export { Blocks };
303
330
  export { bubbles };
331
+ /** @deprecated Use Blockly.bubbles.Bubble instead. To be removed in v11. */
332
+ export { Bubble };
304
333
  export { BubbleDragger };
305
334
  export { CollapsibleToolboxCategory };
306
335
  export { ComponentManager };
@@ -343,6 +372,7 @@ export { IBubble };
343
372
  export { ICollapsibleToolboxItem };
344
373
  export { IComponent };
345
374
  export { IConnectionChecker };
375
+ export { IConnectionPreviewer };
346
376
  export { IContextMenu };
347
377
  export { icons };
348
378
  export { ICopyable, isCopyable };
@@ -359,6 +389,7 @@ export { IMovable };
359
389
  export { Input };
360
390
  export { inputs };
361
391
  export { InsertionMarkerManager };
392
+ export { InsertionMarkerPreviewer };
362
393
  export { IObservable, isObservable };
363
394
  export { IPaster, isPaster };
364
395
  export { IPositionable };
@@ -402,6 +433,10 @@ export { WorkspaceDragger };
402
433
  export { WorkspaceSvg };
403
434
  export { ZoomControls };
404
435
  export { config };
436
+ /** @deprecated Use Blockly.ConnectionType instead. */
437
+ export declare const connectionTypes: typeof ConnectionType;
405
438
  export { inject };
439
+ /** @deprecated Use Blockly.inputs.inputTypes instead. To be removed in v11. */
440
+ export { inputTypes };
406
441
  export { serialization };
407
442
  //# sourceMappingURL=blockly.d.ts.map
@@ -8,6 +8,14 @@ import { BlockPaster } from './clipboard/block_paster.js';
8
8
  import { WorkspaceSvg } from './workspace_svg.js';
9
9
  import * as registry from './clipboard/registry.js';
10
10
  import { Coordinate } from './utils/coordinate.js';
11
+ /**
12
+ * Copy a copyable element onto the local clipboard.
13
+ *
14
+ * @param toCopy The copyable element to be copied.
15
+ * @deprecated v11. Use `myCopyable.toCopyData()` instead. To be removed v12.
16
+ * @internal
17
+ */
18
+ export declare function copy<T extends ICopyData>(toCopy: ICopyable<T>): T | null;
11
19
  /**
12
20
  * Private version of copy for stubbing in tests.
13
21
  */
@@ -27,6 +35,17 @@ export declare function paste<T extends ICopyData>(copyData: T, workspace: Works
27
35
  * @returns the pasted thing if the paste was successful, null otherwise.
28
36
  */
29
37
  export declare function paste(): ICopyable<ICopyData> | null;
38
+ /**
39
+ * Duplicate this copy-paste-able element.
40
+ *
41
+ * @param toDuplicate The element to be duplicated.
42
+ * @returns The element that was duplicated, or null if the duplication failed.
43
+ * @deprecated v11. Use
44
+ * `Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)` instead.
45
+ * To be removed v12.
46
+ * @internal
47
+ */
48
+ export declare function duplicate<U extends ICopyData, T extends ICopyable<U> & IHasWorkspace>(toDuplicate: T): T | null;
30
49
  /**
31
50
  * Private version of duplicate for stubbing in tests.
32
51
  */
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BlockSvg } from '../block_svg.js';
7
+ import { IConnectionPreviewer } from '../interfaces/i_connection_previewer.js';
8
+ import { RenderedConnection } from '../rendered_connection.js';
9
+ export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
10
+ private readonly workspace;
11
+ private fadedBlock;
12
+ private markerConn;
13
+ private draggedConn;
14
+ private staticConn;
15
+ constructor(draggedBlock: BlockSvg);
16
+ /**
17
+ * Display a connection preview where the draggedCon connects to the
18
+ * staticCon, replacing the replacedBlock (currently connected to the
19
+ * staticCon).
20
+ *
21
+ * @param draggedConn The connection on the block stack being dragged.
22
+ * @param staticConn The connection not being dragged that we are
23
+ * connecting to.
24
+ * @param replacedBlock The block currently connected to the staticCon that
25
+ * is being replaced.
26
+ */
27
+ previewReplacement(draggedConn: RenderedConnection, staticConn: RenderedConnection, replacedBlock: BlockSvg): void;
28
+ /**
29
+ * Display a connection preview where the draggedCon connects to the
30
+ * staticCon, and no block is being relaced.
31
+ *
32
+ * @param draggedConn The connection on the block stack being dragged.
33
+ * @param staticConn The connection not being dragged that we are
34
+ * connecting to.
35
+ */
36
+ previewConnection(draggedConn: RenderedConnection, staticConn: RenderedConnection): void;
37
+ private shouldUseMarkerPreview;
38
+ private previewMarker;
39
+ private createInsertionMarker;
40
+ /**
41
+ * Gets the connection on the marker block that matches the original
42
+ * connection on the original block.
43
+ *
44
+ * @param orig The original block.
45
+ * @param marker The marker block (where we want to find the matching
46
+ * connection).
47
+ * @param origConn The original connection.
48
+ */
49
+ private getMatchingConnection;
50
+ /** Hide any previews that are currently displayed. */
51
+ hidePreview(): void;
52
+ private hideInsertionMarker;
53
+ /** Dispose of any references held by this connection previewer. */
54
+ dispose(): void;
55
+ }
56
+ //# sourceMappingURL=insertion_marker_previewer.d.ts.map
package/core/gesture.d.ts CHANGED
@@ -86,8 +86,6 @@ export declare class Gesture {
86
86
  * is in progress.
87
87
  */
88
88
  private workspaceDragger;
89
- /** Whether the gesture is dragging or not. */
90
- private dragging;
91
89
  /** The flyout a gesture started in, if any. */
92
90
  private flyout;
93
91
  /** Boolean for sanity-checking that some code is only called once. */
package/core/grid.d.ts CHANGED
@@ -9,11 +9,12 @@ import { GridOptions } from './options.js';
9
9
  */
10
10
  export declare class Grid {
11
11
  private pattern;
12
- private readonly spacing;
13
- private readonly length;
12
+ private spacing;
13
+ private length;
14
+ private scale;
14
15
  private readonly line1;
15
16
  private readonly line2;
16
- private readonly snapToGrid;
17
+ private snapToGrid;
17
18
  /**
18
19
  * @param pattern The grid's SVG pattern, created during injection.
19
20
  * @param options A dictionary of normalized options for the grid.
@@ -21,6 +22,26 @@ export declare class Grid {
21
22
  * https://developers.google.com/blockly/guides/configure/web/grid
22
23
  */
23
24
  constructor(pattern: SVGElement, options: GridOptions);
25
+ /**
26
+ * Sets the spacing between the centers of the grid lines.
27
+ *
28
+ * This does not trigger snapping to the newly spaced grid. If you want to
29
+ * snap blocks to the grid programmatically that needs to be triggered
30
+ * on individual top-level blocks. The next time a block is dragged and
31
+ * dropped it will snap to the grid if snapping to the grid is enabled.
32
+ */
33
+ setSpacing(spacing: number): void;
34
+ /** Sets the length of the grid lines. */
35
+ setLength(length: number): void;
36
+ /**
37
+ * Sets whether blocks should snap to the grid or not.
38
+ *
39
+ * Setting this to true does not trigger snapping. If you want to snap blocks
40
+ * to the grid programmatically that needs to be triggered on individual
41
+ * top-level blocks. The next time a block is dragged and dropped it will
42
+ * snap to the grid.
43
+ */
44
+ setSnapToGrid(snap: boolean): void;
24
45
  /**
25
46
  * Whether blocks should snap to the grid, based on the initial configuration.
26
47
  *
@@ -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(): Promise<void>;
52
+ updateEditable(): 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): Promise<void>;
85
+ setBubbleVisible(visible: boolean): 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.
@@ -59,5 +59,11 @@ 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;
62
68
  }
63
69
  //# sourceMappingURL=icon.d.ts.map
@@ -4,7 +4,9 @@
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';
7
8
  import type { BlockSvg } from '../block_svg.js';
9
+ import type { Connection } from '../connection.js';
8
10
  import { Coordinate } from '../utils/coordinate.js';
9
11
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
10
12
  import { Icon } from './icon.js';
@@ -53,7 +55,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
53
55
  onClick(): void;
54
56
  isClickableInFlyout(): boolean;
55
57
  bubbleIsVisible(): boolean;
56
- setBubbleVisible(visible: boolean): Promise<void>;
58
+ setBubbleVisible(visible: boolean): void;
57
59
  /** @returns the configuration the mini workspace should have. */
58
60
  private getMiniWorkspaceConfig;
59
61
  /**
@@ -89,5 +91,18 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
89
91
  * currently open.
90
92
  */
91
93
  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;
92
107
  }
93
108
  //# 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): Promise<void>;
62
+ setBubbleVisible(visible: boolean): void;
63
63
  /**
64
64
  * @returns the location the bubble should be anchored to.
65
65
  * I.E. the middle of this icon.
@@ -15,14 +15,13 @@ 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';
19
18
  /** Class for an input with optional fields. */
20
19
  export declare class Input {
21
20
  name: string;
22
21
  private sourceBlock;
23
22
  fieldRow: Field[];
24
23
  /** Alignment of input's fields (left, right or centre). */
25
- align: Align;
24
+ align: Input.Align;
26
25
  /** Is the input visible? */
27
26
  private visible;
28
27
  readonly type: inputTypes;
@@ -122,14 +121,6 @@ export declare class Input {
122
121
  getShadowDom(): Element | null;
123
122
  /** Initialize the fields on this input. */
124
123
  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;
133
124
  /**
134
125
  * Sever all links to this input.
135
126
  */
@@ -144,4 +135,22 @@ export declare class Input {
144
135
  */
145
136
  protected makeConnection(type: ConnectionType): Connection;
146
137
  }
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;
147
156
  //# sourceMappingURL=input.d.ts.map
@@ -10,6 +10,8 @@ import type { Coordinate } from './utils/coordinate.js';
10
10
  * Class that controls updates to connections during drags. It is primarily
11
11
  * responsible for finding the closest eligible connection and highlighting or
12
12
  * unhighlighting it as needed during a drag.
13
+ *
14
+ * @deprecated v10 - Use an IConnectionPreviewer instead.
13
15
  */
14
16
  export declare class InsertionMarkerManager {
15
17
  /**
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../block_svg';
7
+ import type { RenderedConnection } from '../rendered_connection';
8
+ /**
9
+ * Displays visual "previews" of where a block will be connected if it is
10
+ * dropped.
11
+ */
12
+ export interface IConnectionPreviewer {
13
+ /**
14
+ * Display a connection preview where the draggedCon connects to the
15
+ * staticCon, replacing the replacedBlock (currently connected to the
16
+ * staticCon).
17
+ *
18
+ * @param draggedCon The connection on the block stack being dragged.
19
+ * @param staticCon The connection not being dragged that we are
20
+ * connecting to.
21
+ * @param replacedBlock The block currently connected to the staticCon that
22
+ * is being replaced.
23
+ */
24
+ previewReplacement(draggedConn: RenderedConnection, staticConn: RenderedConnection, replacedBlock: BlockSvg): void;
25
+ /**
26
+ * Display a connection preview where the draggedCon connects to the
27
+ * staticCon, and no block is being relaced.
28
+ *
29
+ * @param draggedCon The connection on the block stack being dragged.
30
+ * @param staticCon The connection not being dragged that we are
31
+ * connecting to.
32
+ */
33
+ previewConnection(draggedConn: RenderedConnection, staticConn: RenderedConnection): void;
34
+ /** Hide any previews that are currently displayed. */
35
+ hidePreview(): void;
36
+ /** Dispose of any references held by this connection previewer. */
37
+ dispose(): void;
38
+ }
39
+ //# sourceMappingURL=i_connection_previewer.d.ts.map
@@ -7,7 +7,7 @@ export interface IHasBubble {
7
7
  /** @returns True if the bubble is currently open, false otherwise. */
8
8
  bubbleIsVisible(): boolean;
9
9
  /** Sets whether the bubble is open or not. */
10
- setBubbleVisible(visible: boolean): Promise<void>;
10
+ setBubbleVisible(visible: boolean): void;
11
11
  }
12
12
  /** Type guard that checks whether the given object is a IHasBubble. */
13
13
  export declare function hasBubble(obj: any): obj is IHasBubble;