blockly 9.3.2 → 10.0.0-beta.0
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/README.md +9 -7
- package/blockly.min.js +1304 -1404
- package/blockly_compressed.js +1057 -1099
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +120 -136
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +59 -32
- package/core/block_dragger.d.ts +2 -2
- package/core/block_svg.d.ts +38 -67
- package/core/blockly.d.ts +18 -112
- package/core/browser_events.d.ts +1 -2
- package/core/bubble_dragger.d.ts +1 -2
- package/core/{bubble.d.ts → bubble_old.d.ts} +3 -7
- package/core/bubbles/bubble.d.ts +174 -0
- package/core/bubbles/mini_workspace_bubble.d.ts +80 -0
- package/core/bubbles/text_bubble.d.ts +35 -0
- package/core/bubbles/textinput_bubble.d.ts +89 -0
- package/core/bump_objects.d.ts +6 -4
- package/core/connection.d.ts +19 -9
- package/core/connection_db.d.ts +4 -4
- package/core/contextmenu.d.ts +1 -2
- package/core/events/events.d.ts +1 -4
- package/core/events/events_abstract.d.ts +0 -6
- package/core/events/events_block_base.d.ts +0 -6
- package/core/events/events_block_change.d.ts +0 -6
- package/core/events/events_block_create.d.ts +0 -6
- package/core/events/events_block_delete.d.ts +0 -6
- package/core/events/events_block_drag.d.ts +0 -6
- package/core/events/events_block_move.d.ts +21 -7
- package/core/events/events_bubble_open.d.ts +0 -6
- package/core/events/events_click.d.ts +0 -6
- package/core/events/events_comment_base.d.ts +0 -6
- package/core/events/events_comment_change.d.ts +0 -6
- package/core/events/events_comment_create.d.ts +0 -6
- package/core/events/events_comment_move.d.ts +0 -6
- package/core/events/events_marker_move.d.ts +0 -6
- package/core/events/events_selected.d.ts +0 -6
- package/core/events/events_theme_change.d.ts +0 -6
- package/core/events/events_toolbox_item_select.d.ts +0 -6
- package/core/events/events_trashcan_open.d.ts +0 -6
- package/core/events/events_var_base.d.ts +0 -6
- package/core/events/events_var_create.d.ts +0 -6
- package/core/events/events_var_delete.d.ts +0 -6
- package/core/events/events_var_rename.d.ts +0 -6
- package/core/events/events_viewport.d.ts +0 -6
- package/core/events/utils.d.ts +1 -1
- package/core/events/workspace_events.d.ts +1 -16
- package/core/field.d.ts +31 -5
- package/core/field_checkbox.d.ts +1 -1
- package/core/field_colour.d.ts +0 -2
- package/core/field_dropdown.d.ts +11 -13
- package/core/field_image.d.ts +5 -5
- package/core/field_input.d.ts +9 -2
- package/core/field_label.d.ts +3 -1
- package/core/field_number.d.ts +4 -4
- package/core/field_variable.d.ts +5 -5
- package/core/flyout_base.d.ts +23 -25
- package/core/flyout_button.d.ts +9 -9
- package/core/flyout_horizontal.d.ts +1 -1
- package/core/flyout_vertical.d.ts +1 -1
- package/core/generator.d.ts +15 -2
- package/core/gesture.d.ts +58 -41
- package/core/icons/comment_icon.d.ts +108 -0
- package/core/icons/exceptions.d.ts +14 -0
- package/core/icons/icon.d.ts +38 -0
- package/core/icons/icon_types.d.ts +22 -0
- package/core/icons/mutator_icon.d.ts +90 -0
- package/core/icons/registry.d.ts +23 -0
- package/core/icons/warning_icon.d.ts +67 -0
- package/core/icons.d.ts +12 -0
- package/core/inputs/dummy_input.d.ts +20 -0
- package/core/{input.d.ts → inputs/input.d.ts} +20 -13
- package/core/{input_types.d.ts → inputs/input_types.d.ts} +2 -1
- package/core/inputs/statement_input.d.ts +22 -0
- package/core/inputs/value_input.d.ts +20 -0
- package/core/interfaces/i_block_dragger.d.ts +1 -1
- package/core/interfaces/i_bounded_element.d.ts +2 -1
- package/core/interfaces/i_bubble.d.ts +2 -14
- package/core/interfaces/i_has_bubble.d.ts +14 -0
- package/core/interfaces/i_icon.d.ts +75 -0
- package/core/interfaces/i_serializable.d.ts +24 -0
- package/core/keyboard_nav/ast_node.d.ts +15 -15
- package/core/keyboard_nav/basic_cursor.d.ts +2 -2
- package/core/keyboard_nav/marker.d.ts +2 -2
- package/core/main.d.ts +0 -10
- package/core/marker_manager.d.ts +0 -1
- package/core/names.d.ts +4 -4
- package/core/options.d.ts +3 -3
- package/core/procedures.d.ts +1 -4
- package/core/registry.d.ts +5 -0
- package/core/render_management.d.ts +9 -1
- package/core/rendered_connection.d.ts +7 -7
- package/core/renderers/common/block_rendering.d.ts +0 -10
- package/core/renderers/common/constants.d.ts +5 -7
- package/core/renderers/common/drawer.d.ts +7 -2
- package/core/renderers/common/info.d.ts +1 -4
- package/core/renderers/common/marker_svg.d.ts +4 -4
- package/core/renderers/common/renderer.d.ts +0 -9
- package/core/renderers/geras/highlighter.d.ts +1 -1
- package/core/renderers/geras/info.d.ts +1 -1
- package/core/renderers/geras/measurables/inline_input.d.ts +1 -1
- package/core/renderers/geras/measurables/statement_input.d.ts +1 -1
- package/core/renderers/geras/renderer.d.ts +1 -1
- package/core/renderers/measurables/external_value_input.d.ts +1 -1
- package/core/renderers/measurables/field.d.ts +1 -1
- package/core/renderers/measurables/icon.d.ts +5 -1
- package/core/renderers/measurables/inline_input.d.ts +1 -1
- package/core/renderers/measurables/input_connection.d.ts +1 -1
- package/core/renderers/measurables/statement_input.d.ts +1 -1
- package/core/renderers/zelos/constants.d.ts +2 -2
- package/core/renderers/zelos/info.d.ts +2 -2
- package/core/renderers/zelos/marker_svg.d.ts +3 -3
- package/core/renderers/zelos/measurables/inputs.d.ts +1 -1
- package/core/renderers/zelos/path_object.d.ts +3 -3
- package/core/scrollbar.d.ts +0 -2
- package/core/scrollbar_pair.d.ts +0 -2
- package/core/serialization/blocks.d.ts +3 -3
- package/core/serialization/exceptions.d.ts +11 -0
- package/core/shortcut_registry.d.ts +2 -2
- package/core/theme_manager.d.ts +0 -1
- package/core/touch.d.ts +0 -43
- package/core/trashcan.d.ts +19 -21
- package/core/utils/dom.d.ts +2 -2
- package/core/utils/object.d.ts +0 -25
- package/core/utils/rect.d.ts +2 -0
- package/core/utils/style.d.ts +0 -12
- package/core/utils/svg_math.d.ts +0 -8
- package/core/utils/xml.d.ts +15 -22
- package/core/utils.d.ts +0 -138
- package/core/widgetdiv.d.ts +5 -0
- package/core/workspace.d.ts +9 -3
- package/core/workspace_comment.d.ts +3 -3
- package/core/workspace_comment_svg.d.ts +31 -44
- package/core/workspace_dragger.d.ts +1 -4
- package/core/workspace_svg.d.ts +13 -50
- package/core/xml.d.ts +0 -12
- package/core-browser.js +0 -1
- package/core.js +0 -1
- package/dart_compressed.js +124 -159
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +127 -169
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +119 -142
- package/lua_compressed.js.map +1 -1
- package/msg/constants.d.ts +1 -3
- package/msg/msg.d.ts +1 -2
- package/msg/qqq.d.ts +1 -3
- package/msg/synonyms.d.ts +1 -3
- package/package.json +12 -13
- package/php_compressed.js +131 -161
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +118 -149
- package/python_compressed.js.map +1 -1
- package/core/comment.d.ts +0 -115
- package/core/events/events_ui.d.ts +0 -40
- package/core/icon.d.ts +0 -89
- package/core/mutator.d.ts +0 -142
- package/core/renderers/common/debug.d.ts +0 -29
- package/core/renderers/common/debugger.d.ts +0 -117
- package/core/warning.d.ts +0 -53
package/core/field_variable.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
18
18
|
protected menuGenerator_: MenuGenerator | undefined;
|
|
19
19
|
defaultVariableName: string;
|
|
20
20
|
/** The type of the default variable for this field. */
|
|
21
|
-
private
|
|
21
|
+
private defaultType;
|
|
22
22
|
/**
|
|
23
23
|
* All of the types of variables that will be available in this field's
|
|
24
24
|
* dropdown.
|
|
@@ -26,7 +26,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
26
26
|
variableTypes: string[] | null;
|
|
27
27
|
protected size_: Size;
|
|
28
28
|
/** The variable model associated with this field. */
|
|
29
|
-
private
|
|
29
|
+
private variable;
|
|
30
30
|
/**
|
|
31
31
|
* Serializable fields are saved by the serializer, non-serializable fields
|
|
32
32
|
* are not. Editable fields should also be serializable.
|
|
@@ -158,14 +158,14 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
158
158
|
* @param type The type to check.
|
|
159
159
|
* @returns True if the type is in the list of allowed types.
|
|
160
160
|
*/
|
|
161
|
-
private
|
|
161
|
+
private typeIsAllowed;
|
|
162
162
|
/**
|
|
163
163
|
* Return a list of variable types to include in the dropdown.
|
|
164
164
|
*
|
|
165
165
|
* @returns Array of variable types.
|
|
166
166
|
* @throws {Error} if variableTypes is an empty array.
|
|
167
167
|
*/
|
|
168
|
-
private
|
|
168
|
+
private getVariableTypes;
|
|
169
169
|
/**
|
|
170
170
|
* Parse the optional arguments representing the allowed variable types and
|
|
171
171
|
* the default variable type.
|
|
@@ -176,7 +176,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
176
176
|
* @param defaultType The type of the variable to create if this field's
|
|
177
177
|
* value is not explicitly set. Defaults to ''.
|
|
178
178
|
*/
|
|
179
|
-
private
|
|
179
|
+
private setTypes;
|
|
180
180
|
/**
|
|
181
181
|
* Refreshes the name of the variable by grabbing the name of the model.
|
|
182
182
|
* Used when a variable gets renamed, but the ID stays the same. Should only
|
package/core/flyout_base.d.ts
CHANGED
|
@@ -102,18 +102,18 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
102
102
|
* Function that will be registered as a change listener on the workspace
|
|
103
103
|
* to reflow when blocks in the flyout workspace change.
|
|
104
104
|
*/
|
|
105
|
-
private
|
|
105
|
+
private reflowWrapper;
|
|
106
106
|
/**
|
|
107
107
|
* Function that disables blocks in the flyout based on max block counts
|
|
108
108
|
* allowed in the target workspace. Registered as a change listener on the
|
|
109
109
|
* target workspace.
|
|
110
110
|
*/
|
|
111
|
-
private
|
|
111
|
+
private filterWrapper;
|
|
112
112
|
/**
|
|
113
113
|
* List of background mats that lurk behind each block to catch clicks
|
|
114
114
|
* landing in the blocks' lakes and bays.
|
|
115
115
|
*/
|
|
116
|
-
private
|
|
116
|
+
private mats;
|
|
117
117
|
/**
|
|
118
118
|
* List of visible buttons.
|
|
119
119
|
*/
|
|
@@ -121,11 +121,11 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
121
121
|
/**
|
|
122
122
|
* List of event listeners.
|
|
123
123
|
*/
|
|
124
|
-
private
|
|
124
|
+
private listeners;
|
|
125
125
|
/**
|
|
126
126
|
* List of blocks that should always be disabled.
|
|
127
127
|
*/
|
|
128
|
-
private
|
|
128
|
+
private permanentlyDisabled;
|
|
129
129
|
protected readonly tabWidth_: number;
|
|
130
130
|
/**
|
|
131
131
|
* The target workspace.
|
|
@@ -136,7 +136,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
136
136
|
/**
|
|
137
137
|
* A list of blocks that can be reused.
|
|
138
138
|
*/
|
|
139
|
-
private
|
|
139
|
+
private recycledBlocks;
|
|
140
140
|
/**
|
|
141
141
|
* Does the flyout automatically close when a block is created?
|
|
142
142
|
*/
|
|
@@ -148,7 +148,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
148
148
|
/**
|
|
149
149
|
* Whether the workspace containing this flyout is visible.
|
|
150
150
|
*/
|
|
151
|
-
private
|
|
151
|
+
private containerVisible;
|
|
152
152
|
protected rectMap_: WeakMap<BlockSvg, SVGElement>;
|
|
153
153
|
/**
|
|
154
154
|
* Corner radius of the flyout background.
|
|
@@ -224,8 +224,6 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
224
224
|
/**
|
|
225
225
|
* Dispose of this flyout.
|
|
226
226
|
* Unlink from all DOM elements to prevent memory leaks.
|
|
227
|
-
*
|
|
228
|
-
* @suppress {checkTypes}
|
|
229
227
|
*/
|
|
230
228
|
dispose(): void;
|
|
231
229
|
/**
|
|
@@ -277,7 +275,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
277
275
|
* Update the display property of the flyout based whether it thinks it should
|
|
278
276
|
* be visible and whether its containing workspace is visible.
|
|
279
277
|
*/
|
|
280
|
-
private
|
|
278
|
+
private updateDisplay;
|
|
281
279
|
/**
|
|
282
280
|
* Update the view based on coordinates calculated in position().
|
|
283
281
|
*
|
|
@@ -307,7 +305,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
307
305
|
* of objects to show in the flyout.
|
|
308
306
|
* @returns The list of contents and gaps needed to lay out the flyout.
|
|
309
307
|
*/
|
|
310
|
-
private
|
|
308
|
+
private createFlyoutInfo;
|
|
311
309
|
/**
|
|
312
310
|
* Gets the flyout definition for the dynamic category.
|
|
313
311
|
*
|
|
@@ -315,7 +313,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
315
313
|
* @returns The definition of the
|
|
316
314
|
* flyout in one of its many forms.
|
|
317
315
|
*/
|
|
318
|
-
private
|
|
316
|
+
private getDynamicCategoryContents;
|
|
319
317
|
/**
|
|
320
318
|
* Creates a flyout button or a flyout label.
|
|
321
319
|
*
|
|
@@ -324,7 +322,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
324
322
|
* @returns The object used to display the button in the
|
|
325
323
|
* flyout.
|
|
326
324
|
*/
|
|
327
|
-
private
|
|
325
|
+
private createButton;
|
|
328
326
|
/**
|
|
329
327
|
* Create a block from the xml and permanently disable any blocks that were
|
|
330
328
|
* defined as disabled.
|
|
@@ -332,7 +330,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
332
330
|
* @param blockInfo The info of the block.
|
|
333
331
|
* @returns The block created from the blockInfo.
|
|
334
332
|
*/
|
|
335
|
-
private
|
|
333
|
+
private createFlyoutBlock;
|
|
336
334
|
/**
|
|
337
335
|
* Returns a block from the array of recycled blocks with the given type, or
|
|
338
336
|
* undefined if one cannot be found.
|
|
@@ -341,7 +339,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
341
339
|
* @returns The recycled block, or undefined if
|
|
342
340
|
* one could not be recycled.
|
|
343
341
|
*/
|
|
344
|
-
private
|
|
342
|
+
private getRecycledBlock;
|
|
345
343
|
/**
|
|
346
344
|
* Adds a gap in the flyout based on block info.
|
|
347
345
|
*
|
|
@@ -350,7 +348,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
350
348
|
* @param defaultGap The default gap between one element and the
|
|
351
349
|
* next.
|
|
352
350
|
*/
|
|
353
|
-
private
|
|
351
|
+
private addBlockGap;
|
|
354
352
|
/**
|
|
355
353
|
* Add the necessary gap in the flyout for a separator.
|
|
356
354
|
*
|
|
@@ -360,15 +358,15 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
360
358
|
* @param defaultGap The default gap between the button and next
|
|
361
359
|
* element.
|
|
362
360
|
*/
|
|
363
|
-
private
|
|
361
|
+
private addSeparatorGap;
|
|
364
362
|
/**
|
|
365
363
|
* Delete blocks, mats and buttons from a previous showing of the flyout.
|
|
366
364
|
*/
|
|
367
|
-
private
|
|
365
|
+
private clearOldBlocks;
|
|
368
366
|
/**
|
|
369
367
|
* Empties all of the recycled blocks, properly disposing of them.
|
|
370
368
|
*/
|
|
371
|
-
private
|
|
369
|
+
private emptyRecycledBlocks;
|
|
372
370
|
/**
|
|
373
371
|
* Returns whether the given block can be recycled or not.
|
|
374
372
|
*
|
|
@@ -383,7 +381,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
383
381
|
*
|
|
384
382
|
* @param block The block to recycle.
|
|
385
383
|
*/
|
|
386
|
-
private
|
|
384
|
+
private recycleBlock;
|
|
387
385
|
/**
|
|
388
386
|
* Add listeners to a block that has been added to the flyout.
|
|
389
387
|
*
|
|
@@ -399,13 +397,13 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
399
397
|
* @param block The flyout block to copy.
|
|
400
398
|
* @returns Function to call when block is clicked.
|
|
401
399
|
*/
|
|
402
|
-
private
|
|
400
|
+
private blockMouseDown;
|
|
403
401
|
/**
|
|
404
402
|
* Pointer down on the flyout background. Start a vertical scroll drag.
|
|
405
403
|
*
|
|
406
404
|
* @param e Pointer down event.
|
|
407
405
|
*/
|
|
408
|
-
private
|
|
406
|
+
private onMouseDown;
|
|
409
407
|
/**
|
|
410
408
|
* Does this flyout allow you to create a new instance of the given block?
|
|
411
409
|
* Used for deciding if a block can be "dragged out of" the flyout.
|
|
@@ -465,7 +463,7 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
465
463
|
* on the workspace, an "a + b" block that has two shadow blocks would be
|
|
466
464
|
* disabled.
|
|
467
465
|
*/
|
|
468
|
-
private
|
|
466
|
+
private filterForCapacity;
|
|
469
467
|
/**
|
|
470
468
|
* Reflow blocks and their mats.
|
|
471
469
|
*/
|
|
@@ -482,14 +480,14 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
|
|
|
482
480
|
* @param oldBlock The flyout block to copy.
|
|
483
481
|
* @returns The new block in the main workspace.
|
|
484
482
|
*/
|
|
485
|
-
private
|
|
483
|
+
private placeNewBlock;
|
|
486
484
|
/**
|
|
487
485
|
* Positions a block on the target workspace.
|
|
488
486
|
*
|
|
489
487
|
* @param oldBlock The flyout block being copied.
|
|
490
488
|
* @param block The block to posiiton.
|
|
491
489
|
*/
|
|
492
|
-
private
|
|
490
|
+
private positionNewBlock;
|
|
493
491
|
}
|
|
494
492
|
/**
|
|
495
493
|
* A flyout content item.
|
package/core/flyout_button.d.ts
CHANGED
|
@@ -19,21 +19,21 @@ export declare class FlyoutButton {
|
|
|
19
19
|
static TEXT_MARGIN_Y: number;
|
|
20
20
|
/** The radius of the flyout button's borders. */
|
|
21
21
|
static BORDER_RADIUS: number;
|
|
22
|
-
private readonly
|
|
23
|
-
private readonly
|
|
24
|
-
private readonly
|
|
25
|
-
private readonly
|
|
22
|
+
private readonly text;
|
|
23
|
+
private readonly position;
|
|
24
|
+
private readonly callbackKey;
|
|
25
|
+
private readonly cssClass;
|
|
26
26
|
/** Mouse up event data. */
|
|
27
|
-
private
|
|
27
|
+
private onMouseUpWrapper;
|
|
28
28
|
info: toolbox.ButtonOrLabelInfo;
|
|
29
29
|
/** The width of the button's rect. */
|
|
30
30
|
width: number;
|
|
31
31
|
/** The height of the button's rect. */
|
|
32
32
|
height: number;
|
|
33
33
|
/** The root SVG group for the button or label. */
|
|
34
|
-
private
|
|
34
|
+
private svgGroup;
|
|
35
35
|
/** The SVG element with the text of the label or button. */
|
|
36
|
-
private
|
|
36
|
+
private svgText;
|
|
37
37
|
/**
|
|
38
38
|
* @param workspace The workspace in which to place this button.
|
|
39
39
|
* @param targetWorkspace The flyout's target workspace.
|
|
@@ -51,7 +51,7 @@ export declare class FlyoutButton {
|
|
|
51
51
|
/** Correctly position the flyout button and make it visible. */
|
|
52
52
|
show(): void;
|
|
53
53
|
/** Update SVG attributes to match internal state. */
|
|
54
|
-
private
|
|
54
|
+
private updateTransform;
|
|
55
55
|
/**
|
|
56
56
|
* Move the button to the given x, y coordinates.
|
|
57
57
|
*
|
|
@@ -83,6 +83,6 @@ export declare class FlyoutButton {
|
|
|
83
83
|
*
|
|
84
84
|
* @param e Pointer up event.
|
|
85
85
|
*/
|
|
86
|
-
private
|
|
86
|
+
private onMouseUp;
|
|
87
87
|
}
|
|
88
88
|
//# sourceMappingURL=flyout_button.d.ts.map
|
|
@@ -44,7 +44,7 @@ export declare class HorizontalFlyout extends Flyout {
|
|
|
44
44
|
* @param width The width of the flyout, not including the rounded corners.
|
|
45
45
|
* @param height The height of the flyout, not including rounded corners.
|
|
46
46
|
*/
|
|
47
|
-
private
|
|
47
|
+
private setBackgroundPath;
|
|
48
48
|
/** Scroll the flyout to the top. */
|
|
49
49
|
scrollToStart(): void;
|
|
50
50
|
/**
|
|
@@ -45,7 +45,7 @@ export declare class VerticalFlyout extends Flyout {
|
|
|
45
45
|
* @param width The width of the flyout, not including the rounded corners.
|
|
46
46
|
* @param height The height of the flyout, not including rounded corners.
|
|
47
47
|
*/
|
|
48
|
-
private
|
|
48
|
+
private setBackgroundPath;
|
|
49
49
|
/** Scroll the flyout to the top. */
|
|
50
50
|
scrollToStart(): void;
|
|
51
51
|
/**
|
package/core/generator.d.ts
CHANGED
|
@@ -7,12 +7,25 @@ import type { Block } from './block.js';
|
|
|
7
7
|
import { Names } from './names.js';
|
|
8
8
|
import type { Workspace } from './workspace.js';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Type declaration for per-block-type generator functions.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/generating-code}
|
|
13
|
+
* @param block The Block instance to generate code for.
|
|
14
|
+
* @param genearator The CodeGenerator calling the function.
|
|
15
|
+
* @returns A string containing the generated code (for statement blocks),
|
|
16
|
+
* or a [code, precedence] tuple (for value/expression blocks), or
|
|
17
|
+
* null if no code should be emitted for block.
|
|
18
|
+
*/
|
|
19
|
+
export type BlockGenerator = (block: Block, generator: CodeGenerator) => [string, number] | string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Class for a code generator that translates the blocks into a language.
|
|
13
22
|
*/
|
|
14
23
|
export declare class CodeGenerator {
|
|
15
24
|
name_: string;
|
|
25
|
+
/** A dictionary of block generator functions keyed by block type. */
|
|
26
|
+
forBlock: {
|
|
27
|
+
[type: string]: BlockGenerator;
|
|
28
|
+
};
|
|
16
29
|
/**
|
|
17
30
|
* This is used as a placeholder in functions defined using
|
|
18
31
|
* CodeGenerator.provideFunction_. It must not be legal code that could
|
package/core/gesture.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { IFlyout } from './interfaces/i_flyout.js';
|
|
|
13
13
|
import { Coordinate } from './utils/coordinate.js';
|
|
14
14
|
import { WorkspaceDragger } from './workspace_dragger.js';
|
|
15
15
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
16
|
+
import type { IIcon } from './interfaces/i_icon.js';
|
|
16
17
|
/**
|
|
17
18
|
* Class for one gesture.
|
|
18
19
|
*/
|
|
@@ -23,30 +24,35 @@ export declare class Gesture {
|
|
|
23
24
|
* pixels, with (0, 0) at the top left of the browser window (pointer event
|
|
24
25
|
* clientX/Y).
|
|
25
26
|
*/
|
|
26
|
-
private
|
|
27
|
-
private
|
|
27
|
+
private mouseDownXY;
|
|
28
|
+
private currentDragDeltaXY;
|
|
28
29
|
/**
|
|
29
30
|
* The bubble that the gesture started on, or null if it did not start on a
|
|
30
31
|
* bubble.
|
|
31
32
|
*/
|
|
32
|
-
private
|
|
33
|
+
private startBubble;
|
|
33
34
|
/**
|
|
34
35
|
* The field that the gesture started on, or null if it did not start on a
|
|
35
36
|
* field.
|
|
36
37
|
*/
|
|
37
|
-
private
|
|
38
|
+
private startField;
|
|
39
|
+
/**
|
|
40
|
+
* The icon that the gesture started on, or null if it did not start on an
|
|
41
|
+
* icon.
|
|
42
|
+
*/
|
|
43
|
+
private startIcon;
|
|
38
44
|
/**
|
|
39
45
|
* The block that the gesture started on, or null if it did not start on a
|
|
40
46
|
* block.
|
|
41
47
|
*/
|
|
42
|
-
private
|
|
48
|
+
private startBlock;
|
|
43
49
|
/**
|
|
44
50
|
* The block that this gesture targets. If the gesture started on a
|
|
45
51
|
* shadow block, this is the first non-shadow parent of the block. If the
|
|
46
52
|
* gesture started in the flyout, this is the root block of the block group
|
|
47
53
|
* that was clicked or dragged.
|
|
48
54
|
*/
|
|
49
|
-
private
|
|
55
|
+
private targetBlock;
|
|
50
56
|
/**
|
|
51
57
|
* The workspace that the gesture started on. There may be multiple
|
|
52
58
|
* workspaces on a page; this is more accurate than using
|
|
@@ -58,7 +64,7 @@ export declare class Gesture {
|
|
|
58
64
|
* A gesture that exceeds the drag radius is a drag even if it ends exactly
|
|
59
65
|
* at its start point.
|
|
60
66
|
*/
|
|
61
|
-
private
|
|
67
|
+
private hasExceededDragRadius;
|
|
62
68
|
/**
|
|
63
69
|
* Array holding info needed to unbind events.
|
|
64
70
|
* Used for disposing.
|
|
@@ -66,25 +72,25 @@ export declare class Gesture {
|
|
|
66
72
|
*/
|
|
67
73
|
private boundEvents;
|
|
68
74
|
/** The object tracking a bubble drag, or null if none is in progress. */
|
|
69
|
-
private
|
|
75
|
+
private bubbleDragger;
|
|
70
76
|
/** The object tracking a block drag, or null if none is in progress. */
|
|
71
|
-
private
|
|
77
|
+
private blockDragger;
|
|
72
78
|
/**
|
|
73
79
|
* The object tracking a workspace or flyout workspace drag, or null if none
|
|
74
80
|
* is in progress.
|
|
75
81
|
*/
|
|
76
|
-
private
|
|
82
|
+
private workspaceDragger;
|
|
77
83
|
/** The flyout a gesture started in, if any. */
|
|
78
|
-
private
|
|
84
|
+
private flyout;
|
|
79
85
|
/** Boolean for sanity-checking that some code is only called once. */
|
|
80
|
-
private
|
|
86
|
+
private calledUpdateIsDragging;
|
|
81
87
|
/** Boolean for sanity-checking that some code is only called once. */
|
|
82
|
-
private
|
|
88
|
+
private gestureHasStarted;
|
|
83
89
|
/** Boolean used internally to break a cycle in disposal. */
|
|
84
90
|
protected isEnding_: boolean;
|
|
85
|
-
private
|
|
91
|
+
private healStack;
|
|
86
92
|
/** The event that most recently updated this gesture. */
|
|
87
|
-
private
|
|
93
|
+
private mostRecentEvent;
|
|
88
94
|
/** Boolean for whether or not this gesture is a multi-touch gesture. */
|
|
89
95
|
private isMultiTouch_;
|
|
90
96
|
/** A map of cached points used for tracking multi-touch gestures. */
|
|
@@ -95,11 +101,11 @@ export declare class Gesture {
|
|
|
95
101
|
* Scales between 0 and 1 mean the most recent zoom was a zoom out.
|
|
96
102
|
* Scales above 1.0 mean the most recent zoom was a zoom in.
|
|
97
103
|
*/
|
|
98
|
-
private
|
|
104
|
+
private previousScale;
|
|
99
105
|
/** The starting distance between two touch points. */
|
|
100
|
-
private
|
|
106
|
+
private startDistance;
|
|
101
107
|
/** Boolean for whether or not the workspace supports pinch-zoom. */
|
|
102
|
-
private
|
|
108
|
+
private isPinchZoomEnabled;
|
|
103
109
|
/**
|
|
104
110
|
* The owner of the dropdownDiv when this gesture first starts.
|
|
105
111
|
* Needed because we'll close the dropdown before fields get to
|
|
@@ -124,7 +130,7 @@ export declare class Gesture {
|
|
|
124
130
|
*
|
|
125
131
|
* @param e The most recent pointer event.
|
|
126
132
|
*/
|
|
127
|
-
private
|
|
133
|
+
private updateFromEvent;
|
|
128
134
|
/**
|
|
129
135
|
* DO MATH to set currentDragDeltaXY_ based on the most recent pointer
|
|
130
136
|
* position.
|
|
@@ -133,7 +139,7 @@ export declare class Gesture {
|
|
|
133
139
|
* with (0, 0) at the window's top left corner.
|
|
134
140
|
* @returns True if the drag just exceeded the drag radius for the first time.
|
|
135
141
|
*/
|
|
136
|
-
private
|
|
142
|
+
private updateDragDelta;
|
|
137
143
|
/**
|
|
138
144
|
* Update this gesture to record whether a block is being dragged from the
|
|
139
145
|
* flyout.
|
|
@@ -145,7 +151,7 @@ export declare class Gesture {
|
|
|
145
151
|
*
|
|
146
152
|
* @returns True if a block is being dragged from the flyout.
|
|
147
153
|
*/
|
|
148
|
-
private
|
|
154
|
+
private updateIsDraggingFromFlyout;
|
|
149
155
|
/**
|
|
150
156
|
* Update this gesture to record whether a bubble is being dragged.
|
|
151
157
|
* This function should be called on a pointermove event the first time
|
|
@@ -155,7 +161,7 @@ export declare class Gesture {
|
|
|
155
161
|
*
|
|
156
162
|
* @returns True if a bubble is being dragged.
|
|
157
163
|
*/
|
|
158
|
-
private
|
|
164
|
+
private updateIsDraggingBubble;
|
|
159
165
|
/**
|
|
160
166
|
* Check whether to start a block drag. If a block should be dragged, either
|
|
161
167
|
* from the flyout or in the workspace, create the necessary BlockDragger and
|
|
@@ -169,7 +175,7 @@ export declare class Gesture {
|
|
|
169
175
|
*
|
|
170
176
|
* @returns True if a block is being dragged.
|
|
171
177
|
*/
|
|
172
|
-
private
|
|
178
|
+
private updateIsDraggingBlock;
|
|
173
179
|
/**
|
|
174
180
|
* Check whether to start a workspace drag. If a workspace is being dragged,
|
|
175
181
|
* create the necessary WorkspaceDragger and start the drag.
|
|
@@ -179,18 +185,18 @@ export declare class Gesture {
|
|
|
179
185
|
* gesture. If a workspace is being dragged this function creates the
|
|
180
186
|
* necessary WorkspaceDragger and starts the drag.
|
|
181
187
|
*/
|
|
182
|
-
private
|
|
188
|
+
private updateIsDraggingWorkspace;
|
|
183
189
|
/**
|
|
184
190
|
* Update this gesture to record whether anything is being dragged.
|
|
185
191
|
* This function should be called on a pointermove event the first time
|
|
186
192
|
* the drag radius is exceeded. It should be called no more than once per
|
|
187
193
|
* gesture.
|
|
188
194
|
*/
|
|
189
|
-
private
|
|
195
|
+
private updateIsDragging;
|
|
190
196
|
/** Create a block dragger and start dragging the selected block. */
|
|
191
|
-
private
|
|
197
|
+
private startDraggingBlock;
|
|
192
198
|
/** Create a bubble dragger and start dragging the selected bubble. */
|
|
193
|
-
private
|
|
199
|
+
private startDraggingBubble;
|
|
194
200
|
/**
|
|
195
201
|
* Start a gesture: update the workspace to indicate that a gesture is in
|
|
196
202
|
* progress and bind pointermove and pointerup handlers.
|
|
@@ -248,7 +254,7 @@ export declare class Gesture {
|
|
|
248
254
|
*
|
|
249
255
|
* @param e A pointermove event.
|
|
250
256
|
*/
|
|
251
|
-
private
|
|
257
|
+
private handlePinch;
|
|
252
258
|
/**
|
|
253
259
|
* Handle a pointerup event and end the gesture.
|
|
254
260
|
*
|
|
@@ -298,7 +304,7 @@ export declare class Gesture {
|
|
|
298
304
|
*
|
|
299
305
|
* @param ws The workspace that a user clicks on.
|
|
300
306
|
*/
|
|
301
|
-
private
|
|
307
|
+
private fireWorkspaceClick;
|
|
302
308
|
/**
|
|
303
309
|
* Handle a pointerdown event on a flyout.
|
|
304
310
|
*
|
|
@@ -324,23 +330,25 @@ export declare class Gesture {
|
|
|
324
330
|
*/
|
|
325
331
|
handleBubbleStart(e: PointerEvent, bubble: IBubble): void;
|
|
326
332
|
/** Execute a bubble click. */
|
|
327
|
-
private
|
|
333
|
+
private doBubbleClick;
|
|
328
334
|
/** Execute a field click. */
|
|
329
|
-
private
|
|
335
|
+
private doFieldClick;
|
|
336
|
+
/** Execute an icon click. */
|
|
337
|
+
private doIconClick;
|
|
330
338
|
/** Execute a block click. */
|
|
331
|
-
private
|
|
339
|
+
private doBlockClick;
|
|
332
340
|
/**
|
|
333
341
|
* Execute a workspace click. When in accessibility mode shift clicking will
|
|
334
342
|
* move the cursor.
|
|
335
343
|
*
|
|
336
344
|
* @param _e A pointerup event.
|
|
337
345
|
*/
|
|
338
|
-
private
|
|
346
|
+
private doWorkspaceClick;
|
|
339
347
|
/**
|
|
340
348
|
* Move the dragged/clicked block to the front of the workspace so that it is
|
|
341
349
|
* not occluded by other blocks.
|
|
342
350
|
*/
|
|
343
|
-
private
|
|
351
|
+
private bringBlockToFront;
|
|
344
352
|
/**
|
|
345
353
|
* Record the field that a gesture started on.
|
|
346
354
|
*
|
|
@@ -348,6 +356,13 @@ export declare class Gesture {
|
|
|
348
356
|
* @internal
|
|
349
357
|
*/
|
|
350
358
|
setStartField<T>(field: Field<T>): void;
|
|
359
|
+
/**
|
|
360
|
+
* Record the icon that a gesture started on.
|
|
361
|
+
*
|
|
362
|
+
* @param icon The icon the gesture started on.
|
|
363
|
+
* @internal
|
|
364
|
+
*/
|
|
365
|
+
setStartIcon(icon: IIcon): void;
|
|
351
366
|
/**
|
|
352
367
|
* Record the bubble that a gesture started on
|
|
353
368
|
*
|
|
@@ -370,47 +385,49 @@ export declare class Gesture {
|
|
|
370
385
|
*
|
|
371
386
|
* @param block The block the gesture targets.
|
|
372
387
|
*/
|
|
373
|
-
private
|
|
388
|
+
private setTargetBlock;
|
|
374
389
|
/**
|
|
375
390
|
* Record the workspace that a gesture started on.
|
|
376
391
|
*
|
|
377
392
|
* @param ws The workspace the gesture started on.
|
|
378
393
|
*/
|
|
379
|
-
private
|
|
394
|
+
private setStartWorkspace;
|
|
380
395
|
/**
|
|
381
396
|
* Record the flyout that a gesture started on.
|
|
382
397
|
*
|
|
383
398
|
* @param flyout The flyout the gesture started on.
|
|
384
399
|
*/
|
|
385
|
-
private
|
|
400
|
+
private setStartFlyout;
|
|
386
401
|
/**
|
|
387
402
|
* Whether this gesture is a click on a bubble. This should only be called
|
|
388
403
|
* when ending a gesture (pointerup).
|
|
389
404
|
*
|
|
390
405
|
* @returns Whether this gesture was a click on a bubble.
|
|
391
406
|
*/
|
|
392
|
-
private
|
|
407
|
+
private isBubbleClick;
|
|
393
408
|
/**
|
|
394
409
|
* Whether this gesture is a click on a block. This should only be called
|
|
395
410
|
* when ending a gesture (pointerup).
|
|
396
411
|
*
|
|
397
412
|
* @returns Whether this gesture was a click on a block.
|
|
398
413
|
*/
|
|
399
|
-
private
|
|
414
|
+
private isBlockClick;
|
|
400
415
|
/**
|
|
401
416
|
* Whether this gesture is a click on a field. This should only be called
|
|
402
417
|
* when ending a gesture (pointerup).
|
|
403
418
|
*
|
|
404
419
|
* @returns Whether this gesture was a click on a field.
|
|
405
420
|
*/
|
|
406
|
-
private
|
|
421
|
+
private isFieldClick;
|
|
422
|
+
/** @returns Whether this gesture is a click on an icon. */
|
|
423
|
+
private isIconClick;
|
|
407
424
|
/**
|
|
408
425
|
* Whether this gesture is a click on a workspace. This should only be called
|
|
409
426
|
* when ending a gesture (pointerup).
|
|
410
427
|
*
|
|
411
428
|
* @returns Whether this gesture was a click on a workspace.
|
|
412
429
|
*/
|
|
413
|
-
private
|
|
430
|
+
private isWorkspaceClick;
|
|
414
431
|
/**
|
|
415
432
|
* Whether this gesture is a drag of either a workspace or block.
|
|
416
433
|
* This function is called externally to block actions that cannot be taken
|