blockly 11.0.0-beta.4 → 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.
- package/blockly.js +22 -0
- package/blockly.min.js +572 -508
- package/blockly_compressed.js +494 -467
- package/blockly_compressed.js.map +1 -1
- package/blocks.js +22 -0
- package/blocks_compressed.js +29 -27
- package/blocks_compressed.js.map +1 -1
- package/browser.js +30 -0
- package/core/block.d.ts +3 -10
- package/core/block_dragger.d.ts +10 -10
- package/core/block_svg.d.ts +32 -5
- package/core/blockly.d.ts +38 -3
- package/core/clipboard.d.ts +19 -0
- package/core/{insertion_marker_previewer.d.ts → connection_previewers/insertion_marker_previewer.d.ts} +3 -3
- package/core/events/events_click.d.ts +1 -1
- package/core/field_angle.d.ts +208 -0
- package/core/field_colour.d.ts +243 -0
- package/core/field_dropdown.d.ts +0 -1
- package/core/field_image.d.ts +1 -1
- package/core/field_multilineinput.d.ts +182 -0
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +0 -2
- package/core/grid.d.ts +9 -9
- package/core/icons/comment_icon.d.ts +3 -3
- package/core/icons/icon.d.ts +6 -0
- package/core/icons/icon_types.d.ts +2 -2
- package/core/icons/mutator_icon.d.ts +16 -1
- package/core/icons/warning_icon.d.ts +1 -1
- package/core/inputs/input.d.ts +19 -10
- package/core/interfaces/i_has_bubble.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +0 -7
- package/core/interfaces/i_procedure_model.d.ts +0 -7
- package/core/options.d.ts +0 -1
- package/core/renderers/common/drawer.d.ts +7 -0
- package/core/renderers/measurables/icon.d.ts +5 -0
- package/core/renderers/minimalist/constants.d.ts +21 -0
- package/core/renderers/minimalist/drawer.d.ts +26 -0
- package/core/renderers/minimalist/info.d.ts +35 -0
- package/core/renderers/minimalist/minimalist.d.ts +12 -0
- package/core/renderers/minimalist/renderer.d.ts +48 -0
- package/core/serialization/procedures.d.ts +26 -28
- package/core/utils/dom.d.ts +9 -0
- package/core/utils/keycodes.d.ts +32 -32
- package/core/utils/size.d.ts +0 -10
- package/core/utils/string.d.ts +10 -0
- package/core/workspace_svg.d.ts +27 -0
- package/core-browser.js +26 -0
- package/core.js +26 -0
- package/dart.d.ts +24 -1
- package/dart.js +22 -0
- package/dart_compressed.js +68 -18
- package/dart_compressed.js.map +1 -1
- package/generators/dart/colour.d.ts +16 -0
- package/generators/dart/dart_generator.d.ts +17 -17
- package/generators/dart/text.d.ts +1 -0
- package/generators/javascript/colour.d.ts +16 -0
- package/generators/javascript/javascript_generator.d.ts +35 -34
- package/generators/javascript/text.d.ts +1 -0
- package/generators/lua/colour.d.ts +16 -0
- package/generators/lua/lua_generator.d.ts +10 -10
- package/generators/lua/text.d.ts +1 -0
- package/generators/php/colour.d.ts +16 -0
- package/generators/php/php_generator.d.ts +36 -36
- package/generators/php/text.d.ts +1 -0
- package/generators/python/colour.d.ts +16 -0
- package/generators/python/python_generator.d.ts +21 -20
- package/generators/python/text.d.ts +1 -0
- package/index.js +7 -19
- package/javascript.d.ts +41 -1
- package/javascript.js +23 -0
- package/javascript_compressed.js +49 -14
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +18 -1
- package/lua.js +22 -0
- package/lua_compressed.js +40 -18
- package/lua_compressed.js.map +1 -1
- package/msg/constants.d.ts +14 -0
- package/msg/msg.d.ts +440 -0
- package/msg/qqq.d.ts +14 -0
- package/msg/synonyms.d.ts +14 -0
- package/node.js +21 -0
- package/package.json +11 -45
- package/php.d.ts +43 -1
- package/php.js +22 -0
- package/php_compressed.js +43 -10
- package/php_compressed.js.map +1 -1
- package/python.d.ts +27 -1
- package/python.js +23 -0
- package/python_compressed.js +37 -18
- package/python_compressed.js.map +1 -1
- package/core/comments/comment_view.d.ts +0 -200
- package/core/comments/workspace_comment.d.ts +0 -94
- package/core/comments.d.ts +0 -8
- package/core/interfaces/i_comment_icon.d.ts +0 -17
- package/core-node.js +0 -31
- package/media/arrow-dropdown.svg +0 -1
- package/media/resize-handle.svg +0 -3
- package/msg/ce.d.ts +0 -8
- package/msg/dtp.d.ts +0 -8
- package/msg/hsb.d.ts +0 -8
- package/msg/tdd.d.ts +0 -8
package/browser.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
;(function(root, factory) {
|
|
3
|
+
if (typeof define === 'function' && define.amd) { // AMD
|
|
4
|
+
define(['./core-browser', './msg/en', './blocks', './javascript'], factory);
|
|
5
|
+
} else if (typeof exports === 'object') { // Node.js
|
|
6
|
+
module.exports = factory(require('./core-browser'), require('./msg/en'), require('./blocks'), require('./javascript'));
|
|
7
|
+
} else { // Browser
|
|
8
|
+
root.Blockly = factory(root.Blockly, root.En, root.BlocklyBlocks, root.BlocklyJS);
|
|
9
|
+
}
|
|
10
|
+
}(this, function(Blockly, En, BlocklyBlocks, BlocklyJS) {
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright 2019 Google LLC
|
|
14
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Blockly module for the browser. This includes Blockly core
|
|
19
|
+
* and built in blocks, the JavaScript code generator and the English block
|
|
20
|
+
* localization files.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/* eslint-disable */
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
// Include the EN Locale by default.
|
|
27
|
+
Blockly.setLocale(En);
|
|
28
|
+
|
|
29
|
+
return Blockly;
|
|
30
|
+
}));
|
package/core/block.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ 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
20
|
import type { IDeletable } from './interfaces/i_deletable.js';
|
|
21
|
-
import {
|
|
21
|
+
import type { IIcon } from './interfaces/i_icon.js';
|
|
22
22
|
import type { MutatorIcon } from './icons/mutator_icon.js';
|
|
23
23
|
import * as Tooltip from './tooltip.js';
|
|
24
24
|
import { Coordinate } from './utils/coordinate.js';
|
|
@@ -138,13 +138,7 @@ export declare class Block implements IASTNodeLocation, IDeletable {
|
|
|
138
138
|
/**
|
|
139
139
|
* Is the current block currently in the process of being disposed?
|
|
140
140
|
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Has this block been fully initialized? E.g. all fields initailized.
|
|
144
|
-
*
|
|
145
|
-
* @internal
|
|
146
|
-
*/
|
|
147
|
-
initialized: boolean;
|
|
141
|
+
private disposing;
|
|
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
|
-
|
|
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
|
*/
|
package/core/block_dragger.d.ts
CHANGED
|
@@ -31,13 +31,11 @@ export declare class BlockDragger implements IBlockDragger {
|
|
|
31
31
|
/** Whether the block would be deleted if dropped immediately. */
|
|
32
32
|
protected wouldDeleteBlock_: boolean;
|
|
33
33
|
protected startXY_: Coordinate;
|
|
34
|
-
/** The parent block at the start of the drag. */
|
|
35
|
-
private startParentConn;
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
38
|
-
* `
|
|
35
|
+
* @deprecated To be removed in v11. Updating icons is now handled by the
|
|
36
|
+
* block's `moveDuringDrag` method.
|
|
39
37
|
*/
|
|
40
|
-
|
|
38
|
+
protected dragIconData_: IconPositionData[];
|
|
41
39
|
/**
|
|
42
40
|
* @param block The block to drag.
|
|
43
41
|
* @param workspace The workspace to drag on.
|
|
@@ -139,11 +137,6 @@ export declare class BlockDragger implements IBlockDragger {
|
|
|
139
137
|
* at the start of the drag, in pixel units.
|
|
140
138
|
*/
|
|
141
139
|
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
140
|
/**
|
|
148
141
|
* Calculates the drag delta and new location values after a block is dragged.
|
|
149
142
|
*
|
|
@@ -196,6 +189,13 @@ export declare class BlockDragger implements IBlockDragger {
|
|
|
196
189
|
* @returns The input coordinate divided by the workspace scale.
|
|
197
190
|
*/
|
|
198
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;
|
|
199
199
|
/**
|
|
200
200
|
* Get a list of the insertion markers that currently exist. Drags have 0, 1,
|
|
201
201
|
* or 2 insertion markers.
|
package/core/block_svg.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
-
*
|
|
545
|
-
|
|
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';
|
|
@@ -28,7 +29,6 @@ import { ConnectionType } from './connection_type.js';
|
|
|
28
29
|
import * as ContextMenu from './contextmenu.js';
|
|
29
30
|
import * as ContextMenuItems from './contextmenu_items.js';
|
|
30
31
|
import { ContextMenuRegistry } from './contextmenu_registry.js';
|
|
31
|
-
import * as comments from './comments.js';
|
|
32
32
|
import * as Css from './css.js';
|
|
33
33
|
import { DeleteArea } from './delete_area.js';
|
|
34
34
|
import * as dialog from './dialog.js';
|
|
@@ -37,11 +37,14 @@ import * as dropDownDiv from './dropdowndiv.js';
|
|
|
37
37
|
import * as Events from './events/events.js';
|
|
38
38
|
import * as Extensions from './extensions.js';
|
|
39
39
|
import { Field, FieldConfig, FieldValidator, UnattachedFieldError } from './field.js';
|
|
40
|
+
import { FieldAngle, FieldAngleConfig, FieldAngleFromJsonConfig, FieldAngleValidator } from './field_angle.js';
|
|
40
41
|
import { FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator } from './field_checkbox.js';
|
|
42
|
+
import { FieldColour, FieldColourConfig, FieldColourFromJsonConfig, FieldColourValidator } from './field_colour.js';
|
|
41
43
|
import { FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
|
|
42
44
|
import { FieldImage, FieldImageConfig, FieldImageFromJsonConfig } from './field_image.js';
|
|
43
45
|
import { FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig } from './field_label.js';
|
|
44
46
|
import { FieldLabelSerializable } from './field_label_serializable.js';
|
|
47
|
+
import { FieldMultilineInput, FieldMultilineInputConfig, FieldMultilineInputFromJsonConfig, FieldMultilineInputValidator } from './field_multilineinput.js';
|
|
45
48
|
import { FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator } from './field_number.js';
|
|
46
49
|
import * as fieldRegistry from './field_registry.js';
|
|
47
50
|
import { FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator } from './field_textinput.js';
|
|
@@ -56,10 +59,12 @@ import { Gesture } from './gesture.js';
|
|
|
56
59
|
import { Grid } from './grid.js';
|
|
57
60
|
import * as icons from './icons.js';
|
|
58
61
|
import { inject } from './inject.js';
|
|
62
|
+
import { Align } from './inputs/align.js';
|
|
59
63
|
import { Input } from './inputs/input.js';
|
|
64
|
+
import { inputTypes } from './inputs/input_types.js';
|
|
60
65
|
import * as inputs from './inputs.js';
|
|
61
66
|
import { InsertionMarkerManager } from './insertion_marker_manager.js';
|
|
62
|
-
import { InsertionMarkerPreviewer } from './insertion_marker_previewer.js';
|
|
67
|
+
import { InsertionMarkerPreviewer } from './connection_previewers/insertion_marker_previewer.js';
|
|
63
68
|
import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
|
|
64
69
|
import { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
|
|
65
70
|
import { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.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 };
|
|
@@ -309,17 +338,19 @@ export { ConnectionType };
|
|
|
309
338
|
export { ConnectionChecker };
|
|
310
339
|
export { ConnectionDB };
|
|
311
340
|
export { ContextMenuRegistry };
|
|
312
|
-
export { comments };
|
|
313
341
|
export { Cursor };
|
|
314
342
|
export { DeleteArea };
|
|
315
343
|
export { DragTarget };
|
|
316
344
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
317
345
|
export { Field, FieldConfig, FieldValidator, UnattachedFieldError };
|
|
346
|
+
export { FieldAngle, FieldAngleConfig, FieldAngleFromJsonConfig, FieldAngleValidator, };
|
|
318
347
|
export { FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, };
|
|
348
|
+
export { FieldColour, FieldColourConfig, FieldColourFromJsonConfig, FieldColourValidator, };
|
|
319
349
|
export { FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, MenuGenerator, MenuGeneratorFunction, MenuOption, };
|
|
320
350
|
export { FieldImage, FieldImageConfig, FieldImageFromJsonConfig };
|
|
321
351
|
export { FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig };
|
|
322
352
|
export { FieldLabelSerializable };
|
|
353
|
+
export { FieldMultilineInput, FieldMultilineInputConfig, FieldMultilineInputFromJsonConfig, FieldMultilineInputValidator, };
|
|
323
354
|
export { FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, };
|
|
324
355
|
export { FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, };
|
|
325
356
|
export { FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, };
|
|
@@ -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
|
package/core/clipboard.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { BlockSvg } from '
|
|
7
|
-
import { IConnectionPreviewer } from '
|
|
8
|
-
import { RenderedConnection } from '
|
|
6
|
+
import { BlockSvg } from '../block_svg.js';
|
|
7
|
+
import { IConnectionPreviewer } from '../interfaces/i_connection_previewer.js';
|
|
8
|
+
import { RenderedConnection } from '../rendered_connection.js';
|
|
9
9
|
export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
10
10
|
private readonly workspace;
|
|
11
11
|
private fadedBlock;
|
|
@@ -13,7 +13,7 @@ import { AbstractEventJson } from './events_abstract.js';
|
|
|
13
13
|
import { UiBase } from './events_ui_base.js';
|
|
14
14
|
import { Workspace } from '../workspace.js';
|
|
15
15
|
/**
|
|
16
|
-
* Notifies listeners that
|
|
16
|
+
* Notifies listeners that ome blockly element was clicked.
|
|
17
17
|
*/
|
|
18
18
|
export declare class Click extends UiBase {
|
|
19
19
|
/** The ID of the block that was clicked, if a block was clicked. */
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2013 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Field } from './field.js';
|
|
7
|
+
import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
|
|
8
|
+
/**
|
|
9
|
+
* Class for an editable angle field.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FieldAngle extends FieldInput<number> {
|
|
12
|
+
/** Half the width of protractor image. */
|
|
13
|
+
static readonly HALF: number;
|
|
14
|
+
/**
|
|
15
|
+
* Radius of protractor circle. Slightly smaller than protractor size since
|
|
16
|
+
* otherwise SVG crops off half the border at the edges.
|
|
17
|
+
*/
|
|
18
|
+
static readonly RADIUS: number;
|
|
19
|
+
/**
|
|
20
|
+
* Default property describing which direction makes an angle field's value
|
|
21
|
+
* increase. Angle increases clockwise (true) or counterclockwise (false).
|
|
22
|
+
*/
|
|
23
|
+
static readonly CLOCKWISE = false;
|
|
24
|
+
/**
|
|
25
|
+
* The default offset of 0 degrees (and all angles). Always offsets in the
|
|
26
|
+
* counterclockwise direction, regardless of the field's clockwise property.
|
|
27
|
+
* Usually either 0 (0 = right) or 90 (0 = up).
|
|
28
|
+
*/
|
|
29
|
+
static readonly OFFSET = 0;
|
|
30
|
+
/**
|
|
31
|
+
* The default maximum angle to allow before wrapping.
|
|
32
|
+
* Usually either 360 (for 0 to 359.9) or 180 (for -179.9 to 180).
|
|
33
|
+
*/
|
|
34
|
+
static readonly WRAP = 360;
|
|
35
|
+
/**
|
|
36
|
+
* The default amount to round angles to when using a mouse or keyboard nav
|
|
37
|
+
* input. Must be a positive integer to support keyboard navigation.
|
|
38
|
+
*/
|
|
39
|
+
static readonly ROUND = 15;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the angle should increase as the angle picker is moved clockwise
|
|
42
|
+
* (true) or counterclockwise (false).
|
|
43
|
+
*/
|
|
44
|
+
private clockwise;
|
|
45
|
+
/**
|
|
46
|
+
* The offset of zero degrees (and all other angles).
|
|
47
|
+
*/
|
|
48
|
+
private offset;
|
|
49
|
+
/**
|
|
50
|
+
* The maximum angle to allow before wrapping.
|
|
51
|
+
*/
|
|
52
|
+
private wrap;
|
|
53
|
+
/**
|
|
54
|
+
* The amount to round angles to when using a mouse or keyboard nav input.
|
|
55
|
+
*/
|
|
56
|
+
private round;
|
|
57
|
+
/**
|
|
58
|
+
* Array holding info needed to unbind events.
|
|
59
|
+
* Used for disposing.
|
|
60
|
+
* Ex: [[node, name, func], [node, name, func]].
|
|
61
|
+
*/
|
|
62
|
+
private boundEvents;
|
|
63
|
+
/** Dynamic red line pointing at the value's angle. */
|
|
64
|
+
private line;
|
|
65
|
+
/** Dynamic pink area extending from 0 to the value's angle. */
|
|
66
|
+
private gauge;
|
|
67
|
+
/** The degree symbol for this field. */
|
|
68
|
+
protected symbol_: SVGTSpanElement | null;
|
|
69
|
+
/**
|
|
70
|
+
* @param value The initial value of the field. Should cast to a number.
|
|
71
|
+
* Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup
|
|
72
|
+
* (only used by subclasses that want to handle configuration and setting
|
|
73
|
+
* the field value after their own constructors have run).
|
|
74
|
+
* @param validator A function that is called to validate changes to the
|
|
75
|
+
* field's value. Takes in a number & returns a validated number, or null
|
|
76
|
+
* to abort the change.
|
|
77
|
+
* @param config A map of options used to configure the field.
|
|
78
|
+
* See the [field creation documentation]{@link
|
|
79
|
+
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/angle#creation}
|
|
80
|
+
* for a list of properties this parameter supports.
|
|
81
|
+
*/
|
|
82
|
+
constructor(value?: string | number | typeof Field.SKIP_SETUP, validator?: FieldAngleValidator, config?: FieldAngleConfig);
|
|
83
|
+
/**
|
|
84
|
+
* Configure the field based on the given map of options.
|
|
85
|
+
*
|
|
86
|
+
* @param config A map of options to configure the field based on.
|
|
87
|
+
*/
|
|
88
|
+
protected configure_(config: FieldAngleConfig): void;
|
|
89
|
+
/**
|
|
90
|
+
* Create the block UI for this field.
|
|
91
|
+
*/
|
|
92
|
+
initView(): void;
|
|
93
|
+
/** Updates the angle when the field rerenders. */
|
|
94
|
+
protected render_(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Create and show the angle field's editor.
|
|
97
|
+
*
|
|
98
|
+
* @param e Optional mouse event that triggered the field to open,
|
|
99
|
+
* or undefined if triggered programmatically.
|
|
100
|
+
*/
|
|
101
|
+
protected showEditor_(e?: Event): void;
|
|
102
|
+
/**
|
|
103
|
+
* Creates the angle dropdown editor.
|
|
104
|
+
*
|
|
105
|
+
* @returns The newly created slider.
|
|
106
|
+
*/
|
|
107
|
+
private dropdownCreate;
|
|
108
|
+
/** Disposes of events and DOM-references belonging to the angle editor. */
|
|
109
|
+
private dropdownDispose;
|
|
110
|
+
/** Hide the editor. */
|
|
111
|
+
private hide;
|
|
112
|
+
/**
|
|
113
|
+
* Set the angle to match the mouse's position.
|
|
114
|
+
*
|
|
115
|
+
* @param e Mouse move event.
|
|
116
|
+
*/
|
|
117
|
+
protected onMouseMove_(e: PointerEvent): void;
|
|
118
|
+
/**
|
|
119
|
+
* Handles and displays values that are input via mouse or arrow key input.
|
|
120
|
+
* These values need to be rounded and wrapped before being displayed so
|
|
121
|
+
* that the text input's value is appropriate.
|
|
122
|
+
*
|
|
123
|
+
* @param angle New angle.
|
|
124
|
+
*/
|
|
125
|
+
private displayMouseOrKeyboardValue;
|
|
126
|
+
/** Redraw the graph with the current angle. */
|
|
127
|
+
private updateGraph;
|
|
128
|
+
/**
|
|
129
|
+
* Handle key down to the editor.
|
|
130
|
+
*
|
|
131
|
+
* @param e Keyboard event.
|
|
132
|
+
*/
|
|
133
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
134
|
+
/**
|
|
135
|
+
* Ensure that the input value is a valid angle.
|
|
136
|
+
*
|
|
137
|
+
* @param newValue The input value.
|
|
138
|
+
* @returns A valid angle, or null if invalid.
|
|
139
|
+
*/
|
|
140
|
+
protected doClassValidation_(newValue?: any): number | null;
|
|
141
|
+
/**
|
|
142
|
+
* Wraps the value so that it is in the range (-360 + wrap, wrap).
|
|
143
|
+
*
|
|
144
|
+
* @param value The value to wrap.
|
|
145
|
+
* @returns The wrapped value.
|
|
146
|
+
*/
|
|
147
|
+
private wrapValue;
|
|
148
|
+
/**
|
|
149
|
+
* Construct a FieldAngle from a JSON arg object.
|
|
150
|
+
*
|
|
151
|
+
* @param options A JSON object with options (angle).
|
|
152
|
+
* @returns The new field instance.
|
|
153
|
+
* @nocollapse
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
static fromJson(options: FieldAngleFromJsonConfig): FieldAngle;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The two main modes of the angle field.
|
|
160
|
+
* Compass specifies:
|
|
161
|
+
* - clockwise: true
|
|
162
|
+
* - offset: 90
|
|
163
|
+
* - wrap: 0
|
|
164
|
+
* - round: 15
|
|
165
|
+
*
|
|
166
|
+
* Protractor specifies:
|
|
167
|
+
* - clockwise: false
|
|
168
|
+
* - offset: 0
|
|
169
|
+
* - wrap: 0
|
|
170
|
+
* - round: 15
|
|
171
|
+
*/
|
|
172
|
+
export declare enum Mode {
|
|
173
|
+
COMPASS = "compass",
|
|
174
|
+
PROTRACTOR = "protractor"
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Extra configuration options for the angle field.
|
|
178
|
+
*/
|
|
179
|
+
export interface FieldAngleConfig extends FieldInputConfig {
|
|
180
|
+
mode?: Mode;
|
|
181
|
+
clockwise?: boolean;
|
|
182
|
+
offset?: number;
|
|
183
|
+
wrap?: number;
|
|
184
|
+
round?: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* fromJson configuration options for the angle field.
|
|
188
|
+
*/
|
|
189
|
+
export interface FieldAngleFromJsonConfig extends FieldAngleConfig {
|
|
190
|
+
angle?: number;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A function that is called to validate changes to the field's value before
|
|
194
|
+
* they are set.
|
|
195
|
+
*
|
|
196
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
197
|
+
* @param newValue The value to be validated.
|
|
198
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
199
|
+
* or `undefined`.
|
|
200
|
+
*
|
|
201
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
202
|
+
*
|
|
203
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
204
|
+
*
|
|
205
|
+
* - `undefined` to set `newValue` as is.
|
|
206
|
+
*/
|
|
207
|
+
export type FieldAngleValidator = FieldInputValidator<number>;
|
|
208
|
+
//# sourceMappingURL=field_angle.d.ts.map
|