blockly 9.0.1 → 9.1.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 +2 -2
- package/blockly.js +1 -1
- package/blockly.min.js +332 -312
- package/blockly_compressed.js +311 -306
- package/blockly_compressed.js.map +1 -1
- package/blocks.js +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/browser.js +1 -1
- package/core/block_drag_surface.d.ts +15 -8
- package/core/block_svg.d.ts +10 -4
- package/core/blockly.d.ts +8 -20
- package/core/bubble.d.ts +32 -32
- package/core/comment.d.ts +15 -19
- package/core/field_angle.d.ts +15 -2
- package/core/field_dropdown.d.ts +19 -24
- package/core/field_variable.d.ts +3 -3
- package/core/generator.d.ts +4 -4
- package/core/interfaces/i_parameter_model.d.ts +8 -0
- package/core/interfaces/i_procedure_block.d.ts +13 -0
- package/core/interfaces/i_procedure_map.d.ts +16 -0
- package/core/menu.d.ts +19 -19
- package/core/menuitem.d.ts +8 -8
- package/core/mutator.d.ts +13 -13
- package/core/procedures/observable_parameter_model.d.ts +11 -0
- package/core/procedures/observable_procedure_map.d.ts +6 -1
- package/core/procedures/observable_procedure_model.d.ts +7 -3
- package/core/procedures/update_procedures.d.ts +13 -0
- package/core/procedures.d.ts +4 -0
- package/core/rendered_connection.d.ts +1 -1
- package/core/renderers/common/constants.d.ts +1 -6
- package/core/scrollbar.d.ts +68 -39
- package/core/serialization/blocks.d.ts +38 -0
- package/core/serialization/priorities.d.ts +4 -0
- package/core/serialization/procedures.d.ts +78 -0
- package/core/serialization/variables.d.ts +33 -0
- package/core/serialization.d.ts +2 -1
- package/core/theme.d.ts +5 -5
- package/core/warning.d.ts +4 -4
- package/core/workspace.d.ts +9 -5
- package/core/workspace_svg.d.ts +26 -26
- package/core/zoom_controls.d.ts +18 -18
- package/core-browser.js +1 -1
- package/core.js +1 -1
- package/dart.js +1 -1
- package/dart_compressed.js +2 -2
- package/dart_compressed.js.map +1 -1
- package/index.js +1 -1
- package/javascript.js +1 -1
- package/javascript_compressed.js +4 -5
- package/javascript_compressed.js.map +1 -1
- package/lua.js +1 -1
- package/lua_compressed.js +2 -3
- package/lua_compressed.js.map +1 -1
- package/msg/ab.js +1 -1
- package/msg/ace.js +1 -1
- package/msg/af.js +1 -1
- package/msg/am.js +1 -1
- package/msg/ar.js +1 -1
- package/msg/ast.js +1 -1
- package/msg/az.js +1 -1
- package/msg/ba.js +1 -1
- package/msg/bcc.js +1 -1
- package/msg/be-tarask.js +1 -1
- package/msg/be.js +1 -1
- package/msg/bg.js +1 -1
- package/msg/bn.js +1 -1
- package/msg/br.js +1 -1
- package/msg/bs.js +1 -1
- package/msg/ca.js +1 -1
- package/msg/cdo.js +1 -1
- package/msg/cs.js +1 -1
- package/msg/da.js +1 -1
- package/msg/de.js +1 -1
- package/msg/diq.js +1 -1
- package/msg/dty.js +1 -1
- package/msg/ee.js +1 -1
- package/msg/el.js +1 -1
- package/msg/en-gb.js +1 -1
- package/msg/en.js +1 -1
- package/msg/eo.js +1 -1
- package/msg/es.js +1 -1
- package/msg/et.js +1 -1
- package/msg/eu.js +1 -1
- package/msg/fa.js +1 -1
- package/msg/fi.js +1 -1
- package/msg/fo.js +1 -1
- package/msg/fr.js +1 -1
- package/msg/frr.js +1 -1
- package/msg/gl.js +1 -1
- package/msg/gn.js +1 -1
- package/msg/gor.js +1 -1
- package/msg/ha.js +1 -1
- package/msg/hak.js +1 -1
- package/msg/he.js +1 -1
- package/msg/hi.js +1 -1
- package/msg/hr.js +1 -1
- package/msg/hrx.js +1 -1
- package/msg/hu.js +1 -1
- package/msg/hy.js +1 -1
- package/msg/ia.js +1 -1
- package/msg/id.js +1 -1
- package/msg/ig.js +1 -1
- package/msg/inh.js +1 -1
- package/msg/is.js +1 -1
- package/msg/it.js +1 -1
- package/msg/ja.js +1 -1
- package/msg/ka.js +1 -1
- package/msg/kab.js +1 -1
- package/msg/kbd-cyrl.js +1 -1
- package/msg/km.js +1 -1
- package/msg/kn.js +1 -1
- package/msg/ko.js +1 -1
- package/msg/ksh.js +1 -1
- package/msg/ku-latn.js +1 -1
- package/msg/ky.js +1 -1
- package/msg/la.js +1 -1
- package/msg/lb.js +1 -1
- package/msg/lki.js +1 -1
- package/msg/lo.js +1 -1
- package/msg/lrc.js +1 -1
- package/msg/lt.js +1 -1
- package/msg/lv.js +1 -1
- package/msg/mg.js +1 -1
- package/msg/mk.js +1 -1
- package/msg/ml.js +1 -1
- package/msg/mnw.js +1 -1
- package/msg/ms.js +1 -1
- package/msg/my.js +1 -1
- package/msg/mzn.js +1 -1
- package/msg/nb.js +1 -1
- package/msg/ne.js +1 -1
- package/msg/nl.js +1 -1
- package/msg/oc.js +1 -1
- package/msg/olo.js +1 -1
- package/msg/pa.js +1 -1
- package/msg/pl.js +1 -1
- package/msg/pms.js +1 -1
- package/msg/ps.js +1 -1
- package/msg/pt-br.js +1 -1
- package/msg/pt.js +1 -1
- package/msg/ro.js +1 -1
- package/msg/ru.js +1 -1
- package/msg/sc.js +1 -1
- package/msg/sco.js +1 -1
- package/msg/sd.js +1 -1
- package/msg/shn.js +1 -1
- package/msg/si.js +1 -1
- package/msg/sk.js +1 -1
- package/msg/skr-arab.js +1 -1
- package/msg/sl.js +1 -1
- package/msg/smn.js +1 -1
- package/msg/sq.js +1 -1
- package/msg/sr-latn.js +1 -1
- package/msg/sr.js +1 -1
- package/msg/sv.js +1 -1
- package/msg/sw.js +1 -1
- package/msg/ta.js +1 -1
- package/msg/tcy.js +1 -1
- package/msg/tdd.js +1 -1
- package/msg/te.js +1 -1
- package/msg/th.js +1 -1
- package/msg/ti.js +1 -1
- package/msg/tl.js +1 -1
- package/msg/tlh.js +1 -1
- package/msg/tr.js +1 -1
- package/msg/ug-arab.js +1 -1
- package/msg/uk.js +1 -1
- package/msg/ur.js +1 -1
- package/msg/uz.js +1 -1
- package/msg/vi.js +1 -1
- package/msg/xmf.js +1 -1
- package/msg/yo.js +1 -1
- package/msg/yue.js +1 -1
- package/msg/zgh.js +1 -1
- package/msg/zh-hans.js +1 -1
- package/msg/zh-hant.js +1 -1
- package/node.js +1 -1
- package/package.json +13 -8
- package/php.js +1 -1
- package/php_compressed.js +2 -3
- package/php_compressed.js.map +1 -1
- package/python.js +1 -1
- package/python_compressed.js +2 -2
- package/python_compressed.js.map +1 -1
package/browser.js
CHANGED
|
@@ -12,25 +12,32 @@ import { Coordinate } from './utils/coordinate.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class BlockDragSurfaceSvg {
|
|
14
14
|
private readonly container;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The root element of the drag surface.
|
|
17
|
+
*/
|
|
18
|
+
private svg;
|
|
17
19
|
/**
|
|
18
20
|
* This is where blocks live while they are being dragged if the drag
|
|
19
21
|
* surface is enabled.
|
|
20
22
|
*/
|
|
21
|
-
private
|
|
23
|
+
private dragGroup;
|
|
22
24
|
/**
|
|
23
25
|
* Cached value for the scale of the drag surface.
|
|
24
26
|
* Used to set/get the correct translation during and after a drag.
|
|
25
27
|
*/
|
|
26
|
-
private
|
|
28
|
+
private scale;
|
|
27
29
|
/**
|
|
28
30
|
* Cached value for the translation of the drag surface.
|
|
29
31
|
* This translation is in pixel units, because the scale is applied to the
|
|
30
32
|
* drag group rather than the top-level SVG.
|
|
31
33
|
*/
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
+
private surfaceXY;
|
|
35
|
+
/**
|
|
36
|
+
* Cached value for the translation of the child drag surface in pixel
|
|
37
|
+
* units. Since the child drag surface tracks the translation of the
|
|
38
|
+
* workspace this is ultimately the translation of the workspace.
|
|
39
|
+
*/
|
|
40
|
+
private readonly childSurfaceXY;
|
|
34
41
|
/** @param container Containing element. */
|
|
35
42
|
constructor(container: Element);
|
|
36
43
|
/**
|
|
@@ -91,13 +98,13 @@ export declare class BlockDragSurfaceSvg {
|
|
|
91
98
|
*
|
|
92
99
|
* @returns Drag surface group element.
|
|
93
100
|
*/
|
|
94
|
-
getGroup(): SVGElement
|
|
101
|
+
getGroup(): SVGElement;
|
|
95
102
|
/**
|
|
96
103
|
* Returns the SVG drag surface.
|
|
97
104
|
*
|
|
98
105
|
* @returns The SVG drag surface.
|
|
99
106
|
*/
|
|
100
|
-
getSvgRoot(): SVGElement
|
|
107
|
+
getSvgRoot(): SVGElement;
|
|
101
108
|
/**
|
|
102
109
|
* Get the current blocks on the drag surface, if any (primarily
|
|
103
110
|
* for BlockSvg.getRelativeToSurfaceXY).
|
package/core/block_svg.d.ts
CHANGED
|
@@ -341,8 +341,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
341
341
|
*/
|
|
342
342
|
applyColour(): void;
|
|
343
343
|
/**
|
|
344
|
-
* Updates the
|
|
345
|
-
* state.
|
|
344
|
+
* Updates the colour of the block (and children) to match the current
|
|
345
|
+
* disabled state.
|
|
346
346
|
*
|
|
347
347
|
* @internal
|
|
348
348
|
*/
|
|
@@ -555,10 +555,16 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
555
555
|
*/
|
|
556
556
|
getPreviousBlock(): BlockSvg | null;
|
|
557
557
|
/**
|
|
558
|
-
*
|
|
559
|
-
*
|
|
558
|
+
* Bumps unconnected blocks out of alignment.
|
|
559
|
+
*
|
|
560
|
+
* Two blocks which aren't actually connected should not coincidentally line
|
|
561
|
+
* up on screen, because that creates confusion for end-users.
|
|
560
562
|
*/
|
|
561
563
|
bumpNeighbours(): void;
|
|
564
|
+
/**
|
|
565
|
+
* Bumps unconnected blocks out of alignment.
|
|
566
|
+
*/
|
|
567
|
+
private bumpNeighboursInternal;
|
|
562
568
|
/**
|
|
563
569
|
* Schedule snapping to grid and bumping neighbours to occur after a brief
|
|
564
570
|
* delay.
|
package/core/blockly.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ import { Field } from './field.js';
|
|
|
42
42
|
import { FieldAngle } from './field_angle.js';
|
|
43
43
|
import { FieldCheckbox } from './field_checkbox.js';
|
|
44
44
|
import { FieldColour } from './field_colour.js';
|
|
45
|
-
import { FieldDropdown } from './field_dropdown.js';
|
|
45
|
+
import { FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
|
|
46
46
|
import { FieldImage } from './field_image.js';
|
|
47
47
|
import { FieldLabel } from './field_label.js';
|
|
48
48
|
import { FieldLabelSerializable } from './field_label_serializable.js';
|
|
@@ -56,7 +56,7 @@ import { FlyoutButton } from './flyout_button.js';
|
|
|
56
56
|
import { HorizontalFlyout } from './flyout_horizontal.js';
|
|
57
57
|
import { FlyoutMetricsManager } from './flyout_metrics_manager.js';
|
|
58
58
|
import { VerticalFlyout } from './flyout_vertical.js';
|
|
59
|
-
import {
|
|
59
|
+
import { CodeGenerator } from './generator.js';
|
|
60
60
|
import { Gesture } from './gesture.js';
|
|
61
61
|
import { Grid } from './grid.js';
|
|
62
62
|
import { Icon } from './icon.js';
|
|
@@ -89,7 +89,6 @@ import { IRegistrable } from './interfaces/i_registrable.js';
|
|
|
89
89
|
import { IRegistrableField } from './interfaces/i_registrable_field.js';
|
|
90
90
|
import { ISelectable } from './interfaces/i_selectable.js';
|
|
91
91
|
import { ISelectableToolboxItem } from './interfaces/i_selectable_toolbox_item.js';
|
|
92
|
-
import { ISerializer as SerializerInterface } from './interfaces/i_serializer.js';
|
|
93
92
|
import { IStyleable } from './interfaces/i_styleable.js';
|
|
94
93
|
import { IToolbox } from './interfaces/i_toolbox.js';
|
|
95
94
|
import { IToolboxItem } from './interfaces/i_toolbox_item.js';
|
|
@@ -118,12 +117,7 @@ import * as thrasos from './renderers/thrasos/thrasos.js';
|
|
|
118
117
|
import * as zelos from './renderers/zelos/zelos.js';
|
|
119
118
|
import { Scrollbar } from './scrollbar.js';
|
|
120
119
|
import { ScrollbarPair } from './scrollbar_pair.js';
|
|
121
|
-
import * as
|
|
122
|
-
import * as serializationExceptions from './serialization/exceptions.js';
|
|
123
|
-
import * as serializationPriorities from './serialization/priorities.js';
|
|
124
|
-
import * as serializationRegistry from './serialization/registry.js';
|
|
125
|
-
import * as serializationVariables from './serialization/variables.js';
|
|
126
|
-
import * as serializationWorkspaces from './serialization/workspaces.js';
|
|
120
|
+
import * as serialization from './serialization.js';
|
|
127
121
|
import * as ShortcutItems from './shortcut_items.js';
|
|
128
122
|
import { ShortcutRegistry } from './shortcut_registry.js';
|
|
129
123
|
import { Theme } from './theme.js';
|
|
@@ -427,6 +421,7 @@ export { Css };
|
|
|
427
421
|
export { Events };
|
|
428
422
|
export { Extensions };
|
|
429
423
|
export { Procedures };
|
|
424
|
+
export { Procedures as procedures };
|
|
430
425
|
export { ShortcutItems };
|
|
431
426
|
export { Themes };
|
|
432
427
|
export { Tooltip };
|
|
@@ -476,7 +471,7 @@ export { Field };
|
|
|
476
471
|
export { FieldAngle };
|
|
477
472
|
export { FieldCheckbox };
|
|
478
473
|
export { FieldColour };
|
|
479
|
-
export { FieldDropdown };
|
|
474
|
+
export { FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption };
|
|
480
475
|
export { FieldImage };
|
|
481
476
|
export { FieldLabel };
|
|
482
477
|
export { FieldLabelSerializable };
|
|
@@ -487,7 +482,8 @@ export { FieldVariable };
|
|
|
487
482
|
export { Flyout };
|
|
488
483
|
export { FlyoutButton };
|
|
489
484
|
export { FlyoutMetricsManager };
|
|
490
|
-
export {
|
|
485
|
+
export { CodeGenerator };
|
|
486
|
+
export { CodeGenerator as Generator };
|
|
491
487
|
export { Gesture };
|
|
492
488
|
export { Grid };
|
|
493
489
|
export { HorizontalFlyout };
|
|
@@ -561,13 +557,5 @@ export { config };
|
|
|
561
557
|
export declare const connectionTypes: typeof ConnectionType;
|
|
562
558
|
export { inject };
|
|
563
559
|
export { inputTypes };
|
|
564
|
-
export
|
|
565
|
-
const blocks: typeof serializationBlocks;
|
|
566
|
-
const exceptions: typeof serializationExceptions;
|
|
567
|
-
const priorities: typeof serializationPriorities;
|
|
568
|
-
const registry: typeof serializationRegistry;
|
|
569
|
-
const variables: typeof serializationVariables;
|
|
570
|
-
const workspaces: typeof serializationWorkspaces;
|
|
571
|
-
type ISerializer = SerializerInterface;
|
|
572
|
-
}
|
|
560
|
+
export { serialization };
|
|
573
561
|
//# sourceMappingURL=blockly.d.ts.map
|
package/core/bubble.d.ts
CHANGED
|
@@ -32,51 +32,51 @@ export declare class Bubble implements IBubble {
|
|
|
32
32
|
/** Distance between arrow point and anchor point. */
|
|
33
33
|
static ANCHOR_RADIUS: number;
|
|
34
34
|
/** Mouse up event data. */
|
|
35
|
-
private static
|
|
35
|
+
private static onMouseUpWrapper;
|
|
36
36
|
/** Mouse move event data. */
|
|
37
|
-
private static
|
|
37
|
+
private static onMouseMoveWrapper;
|
|
38
38
|
workspace_: WorkspaceSvg;
|
|
39
39
|
content_: SVGElement;
|
|
40
40
|
shape_: SVGElement;
|
|
41
41
|
/** Flag to stop incremental rendering during construction. */
|
|
42
|
-
private readonly
|
|
42
|
+
private readonly rendered;
|
|
43
43
|
/** The SVG group containing all parts of the bubble. */
|
|
44
|
-
private
|
|
44
|
+
private bubbleGroup;
|
|
45
45
|
/**
|
|
46
46
|
* The SVG path for the arrow from the bubble to the icon on the block.
|
|
47
47
|
*/
|
|
48
|
-
private
|
|
48
|
+
private bubbleArrow;
|
|
49
49
|
/** The SVG rect for the main body of the bubble. */
|
|
50
|
-
private
|
|
50
|
+
private bubbleBack;
|
|
51
51
|
/** The SVG group for the resize hash marks on some bubbles. */
|
|
52
|
-
private
|
|
52
|
+
private resizeGroup;
|
|
53
53
|
/** Absolute coordinate of anchor point, in workspace coordinates. */
|
|
54
|
-
private
|
|
54
|
+
private anchorXY;
|
|
55
55
|
/**
|
|
56
56
|
* Relative X coordinate of bubble with respect to the anchor's centre,
|
|
57
57
|
* in workspace units.
|
|
58
58
|
* In RTL mode the initial value is negated.
|
|
59
59
|
*/
|
|
60
|
-
private
|
|
60
|
+
private relativeLeft;
|
|
61
61
|
/**
|
|
62
62
|
* Relative Y coordinate of bubble with respect to the anchor's centre, in
|
|
63
63
|
* workspace units.
|
|
64
64
|
*/
|
|
65
|
-
private
|
|
65
|
+
private relativeTop;
|
|
66
66
|
/** Width of bubble, in workspace units. */
|
|
67
|
-
private
|
|
67
|
+
private width;
|
|
68
68
|
/** Height of bubble, in workspace units. */
|
|
69
|
-
private
|
|
69
|
+
private height;
|
|
70
70
|
/** Automatically position and reposition the bubble. */
|
|
71
|
-
private
|
|
71
|
+
private autoLayout;
|
|
72
72
|
/** Method to call on resize of bubble. */
|
|
73
|
-
private
|
|
73
|
+
private resizeCallback;
|
|
74
74
|
/** Method to call on move of bubble. */
|
|
75
|
-
private
|
|
76
|
-
/** Mouse down on
|
|
77
|
-
private
|
|
78
|
-
/** Mouse down on
|
|
79
|
-
private
|
|
75
|
+
private moveCallback;
|
|
76
|
+
/** Mouse down on bubbleBack event data. */
|
|
77
|
+
private onMouseDownBubbleWrapper;
|
|
78
|
+
/** Mouse down on resizeGroup event data. */
|
|
79
|
+
private onMouseDownResizeWrapper;
|
|
80
80
|
/**
|
|
81
81
|
* Describes whether this bubble has been disposed of (nodes and event
|
|
82
82
|
* listeners removed from the page) or not.
|
|
@@ -84,7 +84,7 @@ export declare class Bubble implements IBubble {
|
|
|
84
84
|
* @internal
|
|
85
85
|
*/
|
|
86
86
|
disposed: boolean;
|
|
87
|
-
private
|
|
87
|
+
private arrowRadians;
|
|
88
88
|
/**
|
|
89
89
|
* @param workspace The workspace on which to draw the bubble.
|
|
90
90
|
* @param content SVG content for the bubble.
|
|
@@ -101,7 +101,7 @@ export declare class Bubble implements IBubble {
|
|
|
101
101
|
* @param hasResize Add diagonal resize gripper if true.
|
|
102
102
|
* @returns The bubble's SVG group.
|
|
103
103
|
*/
|
|
104
|
-
private
|
|
104
|
+
private createDom;
|
|
105
105
|
/**
|
|
106
106
|
* Return the root node of the bubble's SVG group.
|
|
107
107
|
*
|
|
@@ -119,7 +119,7 @@ export declare class Bubble implements IBubble {
|
|
|
119
119
|
*
|
|
120
120
|
* @param e Mouse down event.
|
|
121
121
|
*/
|
|
122
|
-
private
|
|
122
|
+
private bubbleMouseDown;
|
|
123
123
|
/**
|
|
124
124
|
* Show the context menu for this bubble.
|
|
125
125
|
*
|
|
@@ -145,13 +145,13 @@ export declare class Bubble implements IBubble {
|
|
|
145
145
|
*
|
|
146
146
|
* @param e Mouse down event.
|
|
147
147
|
*/
|
|
148
|
-
private
|
|
148
|
+
private resizeMouseDown;
|
|
149
149
|
/**
|
|
150
150
|
* Resize this bubble to follow the mouse.
|
|
151
151
|
*
|
|
152
152
|
* @param e Mouse move event.
|
|
153
153
|
*/
|
|
154
|
-
private
|
|
154
|
+
private resizeMouseMove;
|
|
155
155
|
/**
|
|
156
156
|
* Register a function as a callback event for when the bubble is resized.
|
|
157
157
|
*
|
|
@@ -179,7 +179,7 @@ export declare class Bubble implements IBubble {
|
|
|
179
179
|
*/
|
|
180
180
|
setAnchorLocation(xy: Coordinate): void;
|
|
181
181
|
/** Position the bubble so that it does not fall off-screen. */
|
|
182
|
-
private
|
|
182
|
+
private layoutBubble;
|
|
183
183
|
/**
|
|
184
184
|
* Calculate the what percentage of the bubble overlaps with the visible
|
|
185
185
|
* workspace (what percentage of the bubble is visible).
|
|
@@ -190,7 +190,7 @@ export declare class Bubble implements IBubble {
|
|
|
190
190
|
* in.
|
|
191
191
|
* @returns The percentage of the bubble that is visible.
|
|
192
192
|
*/
|
|
193
|
-
private
|
|
193
|
+
private getOverlap;
|
|
194
194
|
/**
|
|
195
195
|
* Calculate what the optimal horizontal position of the top-left corner of
|
|
196
196
|
* the bubble is (relative to the anchor point) so that the most area of the
|
|
@@ -201,7 +201,7 @@ export declare class Bubble implements IBubble {
|
|
|
201
201
|
* @returns The optimal horizontal position of the top-left corner of the
|
|
202
202
|
* bubble.
|
|
203
203
|
*/
|
|
204
|
-
private
|
|
204
|
+
private getOptimalRelativeLeft;
|
|
205
205
|
/**
|
|
206
206
|
* Calculate what the optimal vertical position of the top-left corner of
|
|
207
207
|
* the bubble is (relative to the anchor point) so that the most area of the
|
|
@@ -212,9 +212,9 @@ export declare class Bubble implements IBubble {
|
|
|
212
212
|
* @returns The optimal vertical position of the top-left corner of the
|
|
213
213
|
* bubble.
|
|
214
214
|
*/
|
|
215
|
-
private
|
|
215
|
+
private getOptimalRelativeTop;
|
|
216
216
|
/** Move the bubble to a location relative to the anchor's centre. */
|
|
217
|
-
private
|
|
217
|
+
private positionBubble;
|
|
218
218
|
/**
|
|
219
219
|
* Move the bubble group to the specified location in workspace coordinates.
|
|
220
220
|
*
|
|
@@ -244,7 +244,7 @@ export declare class Bubble implements IBubble {
|
|
|
244
244
|
*/
|
|
245
245
|
setBubbleSize(width: number, height: number): void;
|
|
246
246
|
/** Draw the arrow between the bubble and the origin. */
|
|
247
|
-
private
|
|
247
|
+
private renderArrow;
|
|
248
248
|
/**
|
|
249
249
|
* Change the colour of a bubble.
|
|
250
250
|
*
|
|
@@ -280,13 +280,13 @@ export declare class Bubble implements IBubble {
|
|
|
280
280
|
*/
|
|
281
281
|
setAutoLayout(enable: boolean): void;
|
|
282
282
|
/** Stop binding to the global mouseup and mousemove events. */
|
|
283
|
-
private static
|
|
283
|
+
private static unbindDragEvents;
|
|
284
284
|
/**
|
|
285
285
|
* Handle a mouse-up event while dragging a bubble's border or resize handle.
|
|
286
286
|
*
|
|
287
287
|
* @param _e Mouse up event.
|
|
288
288
|
*/
|
|
289
|
-
private static
|
|
289
|
+
private static bubbleMouseUp;
|
|
290
290
|
/**
|
|
291
291
|
* Create the text for a non editable bubble.
|
|
292
292
|
*
|
package/core/comment.d.ts
CHANGED
|
@@ -14,24 +14,24 @@ import type { Size } from './utils/size.js';
|
|
|
14
14
|
* @alias Blockly.Comment
|
|
15
15
|
*/
|
|
16
16
|
export declare class Comment extends Icon {
|
|
17
|
-
private readonly
|
|
17
|
+
private readonly model;
|
|
18
18
|
/**
|
|
19
19
|
* The model's text value at the start of an edit.
|
|
20
20
|
* Used to tell if an event should be fired at the end of an edit.
|
|
21
21
|
*/
|
|
22
|
-
private
|
|
22
|
+
private cachedText;
|
|
23
23
|
/** Mouse up event data. */
|
|
24
|
-
private
|
|
24
|
+
private onMouseUpWrapper;
|
|
25
25
|
/** Wheel event data. */
|
|
26
|
-
private
|
|
26
|
+
private onWheelWrapper;
|
|
27
27
|
/** Change event data. */
|
|
28
|
-
private
|
|
28
|
+
private onChangeWrapper;
|
|
29
29
|
/** Input event data. */
|
|
30
|
-
private
|
|
30
|
+
private onInputWrapper;
|
|
31
31
|
/**
|
|
32
32
|
* The SVG element that contains the text edit area, or null if not created.
|
|
33
33
|
*/
|
|
34
|
-
private
|
|
34
|
+
private foreignObject;
|
|
35
35
|
/** The editable text area, or null if not created. */
|
|
36
36
|
private textarea_;
|
|
37
37
|
/** The top-level node of the comment text, or null if not created. */
|
|
@@ -49,19 +49,19 @@ export declare class Comment extends Icon {
|
|
|
49
49
|
*
|
|
50
50
|
* @returns The top-level node of the editor.
|
|
51
51
|
*/
|
|
52
|
-
private
|
|
52
|
+
private createEditor;
|
|
53
53
|
/** Add or remove editability of the comment. */
|
|
54
54
|
updateEditable(): void;
|
|
55
55
|
/**
|
|
56
56
|
* Callback function triggered when the bubble has resized.
|
|
57
57
|
* Resize the text area accordingly.
|
|
58
58
|
*/
|
|
59
|
-
private
|
|
59
|
+
private onBubbleResize;
|
|
60
60
|
/**
|
|
61
61
|
* Resizes the text area to match the size defined on the model (which is
|
|
62
62
|
* the size of the bubble).
|
|
63
63
|
*/
|
|
64
|
-
private
|
|
64
|
+
private resizeTextarea;
|
|
65
65
|
/**
|
|
66
66
|
* Show or hide the comment bubble.
|
|
67
67
|
*
|
|
@@ -69,21 +69,17 @@ export declare class Comment extends Icon {
|
|
|
69
69
|
*/
|
|
70
70
|
setVisible(visible: boolean): void;
|
|
71
71
|
/** Show the bubble. Handles deciding if it should be editable or not. */
|
|
72
|
-
private
|
|
72
|
+
private createBubble;
|
|
73
73
|
/** Show an editable bubble. */
|
|
74
|
-
private
|
|
74
|
+
private createEditableBubble;
|
|
75
75
|
/**
|
|
76
76
|
* Show a non-editable bubble.
|
|
77
|
-
*
|
|
78
|
-
* @suppress {checkTypes} Suppress `this` type mismatch.
|
|
79
77
|
*/
|
|
80
|
-
private
|
|
78
|
+
private createNonEditableBubble;
|
|
81
79
|
/**
|
|
82
80
|
* Dispose of the bubble.
|
|
83
|
-
*
|
|
84
|
-
* @suppress {checkTypes} Suppress `this` type mismatch.
|
|
85
81
|
*/
|
|
86
|
-
private
|
|
82
|
+
private disposeBubble;
|
|
87
83
|
/**
|
|
88
84
|
* Callback fired when an edit starts.
|
|
89
85
|
*
|
|
@@ -92,7 +88,7 @@ export declare class Comment extends Icon {
|
|
|
92
88
|
*
|
|
93
89
|
* @param _e Mouse up event.
|
|
94
90
|
*/
|
|
95
|
-
private
|
|
91
|
+
private startEdit;
|
|
96
92
|
/**
|
|
97
93
|
* Get the dimensions of this comment's bubble.
|
|
98
94
|
*
|
package/core/field_angle.d.ts
CHANGED
|
@@ -40,16 +40,29 @@ export declare class FieldAngle extends FieldTextInput {
|
|
|
40
40
|
* otherwise SVG crops off half the border at the edges.
|
|
41
41
|
*/
|
|
42
42
|
static readonly RADIUS: number;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the angle should increase as the angle picker is moved clockwise
|
|
45
|
+
* (true) or counterclockwise (false).
|
|
46
|
+
*/
|
|
43
47
|
private clockwise_;
|
|
48
|
+
/**
|
|
49
|
+
* The offset of zero degrees (and all other angles).
|
|
50
|
+
*/
|
|
44
51
|
private offset_;
|
|
52
|
+
/**
|
|
53
|
+
* The maximum angle to allow before wrapping.
|
|
54
|
+
*/
|
|
45
55
|
private wrap_;
|
|
56
|
+
/**
|
|
57
|
+
* The amount to round angles to when using a mouse or keyboard nav input.
|
|
58
|
+
*/
|
|
46
59
|
private round_;
|
|
47
60
|
/** The angle picker's SVG element. */
|
|
48
61
|
private editor_;
|
|
49
62
|
/** The angle picker's gauge path depending on the value. */
|
|
50
|
-
gauge_:
|
|
63
|
+
gauge_: SVGPathElement | null;
|
|
51
64
|
/** The angle picker's line drawn representing the value's angle. */
|
|
52
|
-
line_:
|
|
65
|
+
line_: SVGLineElement | null;
|
|
53
66
|
/** The degree symbol for this field. */
|
|
54
67
|
protected symbol_: SVGTSpanElement;
|
|
55
68
|
/** Wrapper click event data. */
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class FieldDropdown extends Field {
|
|
|
20
20
|
* height.
|
|
21
21
|
*/
|
|
22
22
|
static MAX_MENU_HEIGHT_VH: number;
|
|
23
|
-
static ARROW_CHAR:
|
|
23
|
+
static ARROW_CHAR: string;
|
|
24
24
|
/** A reference to the currently selected menu item. */
|
|
25
25
|
private selectedMenuItem_;
|
|
26
26
|
/** The dropdown menu. */
|
|
@@ -40,7 +40,7 @@ export declare class FieldDropdown extends Field {
|
|
|
40
40
|
SERIALIZABLE: boolean;
|
|
41
41
|
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
42
42
|
CURSOR: string;
|
|
43
|
-
protected menuGenerator_
|
|
43
|
+
protected menuGenerator_?: MenuGenerator;
|
|
44
44
|
/** A cache of the most recently generated options. */
|
|
45
45
|
private generatedOptions_;
|
|
46
46
|
/**
|
|
@@ -56,7 +56,7 @@ export declare class FieldDropdown extends Field {
|
|
|
56
56
|
*/
|
|
57
57
|
suffixField: string | null;
|
|
58
58
|
private selectedOption_;
|
|
59
|
-
clickTarget_:
|
|
59
|
+
clickTarget_: SVGElement | null;
|
|
60
60
|
/**
|
|
61
61
|
* @param menuGenerator A non-empty array of options for a dropdown list, or a
|
|
62
62
|
* function which generates these options. Also accepts Field.SKIP_SETUP
|
|
@@ -73,7 +73,8 @@ export declare class FieldDropdown extends Field {
|
|
|
73
73
|
* for a list of properties this parameter supports.
|
|
74
74
|
* @throws {TypeError} If `menuGenerator` options are incorrectly structured.
|
|
75
75
|
*/
|
|
76
|
-
constructor(menuGenerator:
|
|
76
|
+
constructor(menuGenerator: MenuGenerator, opt_validator?: Function, opt_config?: FieldConfig);
|
|
77
|
+
constructor(menuGenerator: Sentinel);
|
|
77
78
|
/**
|
|
78
79
|
* Sets the field's value based on the given XML element. Should only be
|
|
79
80
|
* called by Blockly.Xml.
|
|
@@ -111,7 +112,7 @@ export declare class FieldDropdown extends Field {
|
|
|
111
112
|
* @param opt_e Optional mouse event that triggered the field to open, or
|
|
112
113
|
* undefined if triggered programmatically.
|
|
113
114
|
*/
|
|
114
|
-
protected showEditor_(opt_e?:
|
|
115
|
+
protected showEditor_(opt_e?: MouseEvent): void;
|
|
115
116
|
/** Create the dropdown editor. */
|
|
116
117
|
private dropdownCreate_;
|
|
117
118
|
/**
|
|
@@ -131,11 +132,6 @@ export declare class FieldDropdown extends Field {
|
|
|
131
132
|
* @param menuItem The MenuItem selected within menu.
|
|
132
133
|
*/
|
|
133
134
|
protected onItemSelected_(menu: Menu, menuItem: MenuItem): void;
|
|
134
|
-
/**
|
|
135
|
-
* Factor out common words in statically defined options.
|
|
136
|
-
* Create prefix and/or suffix labels.
|
|
137
|
-
*/
|
|
138
|
-
private trimOptions_;
|
|
139
135
|
/**
|
|
140
136
|
* @returns True if the option list is generated by a function.
|
|
141
137
|
* Otherwise false.
|
|
@@ -150,21 +146,21 @@ export declare class FieldDropdown extends Field {
|
|
|
150
146
|
* (human-readable text or image, language-neutral name).
|
|
151
147
|
* @throws {TypeError} If generated options are incorrectly structured.
|
|
152
148
|
*/
|
|
153
|
-
getOptions(opt_useCache?: boolean):
|
|
149
|
+
getOptions(opt_useCache?: boolean): MenuOption[];
|
|
154
150
|
/**
|
|
155
151
|
* Ensure that the input value is a valid language-neutral option.
|
|
156
152
|
*
|
|
157
153
|
* @param opt_newValue The input value.
|
|
158
154
|
* @returns A valid language-neutral option, or null if invalid.
|
|
159
155
|
*/
|
|
160
|
-
protected doClassValidation_(opt_newValue?:
|
|
156
|
+
protected doClassValidation_(opt_newValue?: MenuOption[1]): string | null;
|
|
161
157
|
/**
|
|
162
158
|
* Update the value of this dropdown field.
|
|
163
159
|
*
|
|
164
160
|
* @param newValue The value to be saved. The default validator guarantees
|
|
165
161
|
* that this is one of the valid dropdown options.
|
|
166
162
|
*/
|
|
167
|
-
protected doValueUpdate_(newValue:
|
|
163
|
+
protected doValueUpdate_(newValue: MenuOption[1]): void;
|
|
168
164
|
/**
|
|
169
165
|
* Updates the dropdown arrow to match the colour/style of the block.
|
|
170
166
|
*
|
|
@@ -206,17 +202,6 @@ export declare class FieldDropdown extends Field {
|
|
|
206
202
|
* @internal
|
|
207
203
|
*/
|
|
208
204
|
static fromJson(options: FieldDropdownFromJsonConfig): FieldDropdown;
|
|
209
|
-
/**
|
|
210
|
-
* Use the calculated prefix and suffix lengths to trim all of the options in
|
|
211
|
-
* the given array.
|
|
212
|
-
*
|
|
213
|
-
* @param options Array of option tuples:
|
|
214
|
-
* (human-readable text or image, language-neutral name).
|
|
215
|
-
* @param prefixLength The length of the common prefix.
|
|
216
|
-
* @param suffixLength The length of the common suffix
|
|
217
|
-
* @returns A new array with all of the option text trimmed.
|
|
218
|
-
*/
|
|
219
|
-
static applyTrim_(options: any[][], prefixLength: number, suffixLength: number): any[][];
|
|
220
205
|
}
|
|
221
206
|
/**
|
|
222
207
|
* Definition of a human-readable image dropdown option.
|
|
@@ -233,6 +218,16 @@ export interface ImageProperties {
|
|
|
233
218
|
* neutral value.
|
|
234
219
|
*/
|
|
235
220
|
export declare type MenuOption = [string | ImageProperties, string];
|
|
221
|
+
/**
|
|
222
|
+
* A function that generates an array of menu options for FieldDropdown
|
|
223
|
+
* or its descendants.
|
|
224
|
+
*/
|
|
225
|
+
export declare type MenuGeneratorFunction = (this: FieldDropdown) => MenuOption[];
|
|
226
|
+
/**
|
|
227
|
+
* Either an array of menu options or a function that generates an array of
|
|
228
|
+
* menu options for FieldDropdown or its descendants.
|
|
229
|
+
*/
|
|
230
|
+
export declare type MenuGenerator = MenuOption[] | MenuGeneratorFunction;
|
|
236
231
|
/**
|
|
237
232
|
* fromJson config for the dropdown field.
|
|
238
233
|
*/
|
package/core/field_variable.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import './events/events_block_change.js';
|
|
7
7
|
import type { Block } from './block.js';
|
|
8
8
|
import { FieldConfig } from './field.js';
|
|
9
|
-
import { FieldDropdown } from './field_dropdown.js';
|
|
9
|
+
import { FieldDropdown, MenuGenerator, MenuOption } from './field_dropdown.js';
|
|
10
10
|
import type { Menu } from './menu.js';
|
|
11
11
|
import type { MenuItem } from './menuitem.js';
|
|
12
12
|
import type { Sentinel } from './utils/sentinel.js';
|
|
@@ -18,7 +18,7 @@ import { VariableModel } from './variable_model.js';
|
|
|
18
18
|
* @alias Blockly.FieldVariable
|
|
19
19
|
*/
|
|
20
20
|
export declare class FieldVariable extends FieldDropdown {
|
|
21
|
-
protected menuGenerator_:
|
|
21
|
+
protected menuGenerator_: MenuGenerator | undefined;
|
|
22
22
|
defaultVariableName: string;
|
|
23
23
|
/** The type of the default variable for this field. */
|
|
24
24
|
private defaultType_;
|
|
@@ -222,7 +222,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
222
222
|
*
|
|
223
223
|
* @returns Array of variable names/id tuples.
|
|
224
224
|
*/
|
|
225
|
-
static dropdownCreate(this: FieldVariable):
|
|
225
|
+
static dropdownCreate(this: FieldVariable): MenuOption[];
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Config options for the variable field.
|
package/core/generator.d.ts
CHANGED
|
@@ -10,13 +10,13 @@ import type { Workspace } from './workspace.js';
|
|
|
10
10
|
* Class for a code generator that translates the blocks into a language.
|
|
11
11
|
*
|
|
12
12
|
* @unrestricted
|
|
13
|
-
* @alias Blockly.
|
|
13
|
+
* @alias Blockly.CodeGenerator
|
|
14
14
|
*/
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class CodeGenerator {
|
|
16
16
|
name_: string;
|
|
17
17
|
/**
|
|
18
18
|
* This is used as a placeholder in functions defined using
|
|
19
|
-
*
|
|
19
|
+
* CodeGenerator.provideFunction_. It must not be legal code that could
|
|
20
20
|
* legitimately appear in a function definition (or comment), and it must
|
|
21
21
|
* not confuse the regular expression parser.
|
|
22
22
|
*/
|
|
@@ -171,7 +171,7 @@ export declare class Generator {
|
|
|
171
171
|
* "listRandom", not "random"). There is no danger of colliding with reserved
|
|
172
172
|
* words, or user-defined variable or procedure names.
|
|
173
173
|
*
|
|
174
|
-
* The code gets output when
|
|
174
|
+
* The code gets output when CodeGenerator.finish() is called.
|
|
175
175
|
*
|
|
176
176
|
* @param desiredName The desired name of the function (e.g. mathIsPrime).
|
|
177
177
|
* @param code A list of statements or one multi-line code string. Use ' '
|
|
@@ -20,6 +20,14 @@ export interface IParameterModel {
|
|
|
20
20
|
* Sets the types of this parameter to the given type.
|
|
21
21
|
*/
|
|
22
22
|
setTypes(types: string[]): this;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the name of this parameter.
|
|
25
|
+
*/
|
|
26
|
+
getName(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Return the types of this parameter.
|
|
29
|
+
*/
|
|
30
|
+
getTypes(): string[];
|
|
23
31
|
/**
|
|
24
32
|
* Returns the unique language-neutral ID for the parameter.
|
|
25
33
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Block } from '../block.js';
|
|
7
|
+
/** The interface for a block which models a procedure. */
|
|
8
|
+
export interface IProcedureBlock {
|
|
9
|
+
doProcedureUpdate(): void;
|
|
10
|
+
}
|
|
11
|
+
/** A type guard which checks if the given block is a procedure block. */
|
|
12
|
+
export declare function isProcedureBlock(block: Block | IProcedureBlock): block is IProcedureBlock;
|
|
13
|
+
//# sourceMappingURL=i_procedure_block.d.ts.map
|