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/bubble_dragger.d.ts
CHANGED
|
@@ -19,14 +19,13 @@ export declare class BubbleDragger {
|
|
|
19
19
|
/** Whether the bubble would be deleted if dropped immediately. */
|
|
20
20
|
private wouldDeleteBubble_;
|
|
21
21
|
private readonly startXY_;
|
|
22
|
-
private dragSurface_;
|
|
23
22
|
/**
|
|
24
23
|
* @param bubble The item on the bubble canvas to drag.
|
|
25
24
|
* @param workspace The workspace to drag on.
|
|
26
25
|
*/
|
|
27
26
|
constructor(bubble: IBubble, workspace: WorkspaceSvg);
|
|
28
27
|
/**
|
|
29
|
-
* Start dragging a bubble.
|
|
28
|
+
* Start dragging a bubble.
|
|
30
29
|
*
|
|
31
30
|
* @internal
|
|
32
31
|
*/
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright 2012 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { BlockDragSurfaceSvg } from './block_drag_surface.js';
|
|
7
6
|
import type { BlockSvg } from './block_svg.js';
|
|
8
7
|
import type { IBubble } from './interfaces/i_bubble.js';
|
|
9
8
|
import { Coordinate } from './utils/coordinate.js';
|
|
@@ -252,15 +251,12 @@ export declare class Bubble implements IBubble {
|
|
|
252
251
|
/** Dispose of this bubble. */
|
|
253
252
|
dispose(): void;
|
|
254
253
|
/**
|
|
255
|
-
* Move this bubble during a drag
|
|
256
|
-
* a drag surface.
|
|
254
|
+
* Move this bubble during a drag.
|
|
257
255
|
*
|
|
258
|
-
* @param dragSurface The surface that carries rendered items during a drag,
|
|
259
|
-
* or null if no drag surface is in use.
|
|
260
256
|
* @param newLoc The location to translate to, in workspace coordinates.
|
|
261
257
|
* @internal
|
|
262
258
|
*/
|
|
263
|
-
moveDuringDrag(
|
|
259
|
+
moveDuringDrag(newLoc: Coordinate): void;
|
|
264
260
|
/**
|
|
265
261
|
* Return the coordinates of the top-left corner of this bubble's body
|
|
266
262
|
* relative to the drawing surface's origin (0,0), in workspace units.
|
|
@@ -304,4 +300,4 @@ export declare class Bubble implements IBubble {
|
|
|
304
300
|
*/
|
|
305
301
|
static createNonEditableBubble(paragraphElement: SVGTextElement, block: BlockSvg, iconXY: Coordinate): Bubble;
|
|
306
302
|
}
|
|
307
|
-
//# sourceMappingURL=
|
|
303
|
+
//# sourceMappingURL=bubble_old.d.ts.map
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IBubble } from '../interfaces/i_bubble.js';
|
|
7
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
8
|
+
import { Rect } from '../utils/rect.js';
|
|
9
|
+
import { Size } from '../utils/size.js';
|
|
10
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
11
|
+
export declare abstract class Bubble implements IBubble {
|
|
12
|
+
protected readonly workspace: WorkspaceSvg;
|
|
13
|
+
protected anchor: Coordinate;
|
|
14
|
+
protected ownerRect?: Rect | undefined;
|
|
15
|
+
/** The width of the border around the bubble. */
|
|
16
|
+
static readonly BORDER_WIDTH = 6;
|
|
17
|
+
/** Double the width of the border around the bubble. */
|
|
18
|
+
static readonly DOUBLE_BORDER: number;
|
|
19
|
+
/** The minimum size the bubble can have. */
|
|
20
|
+
static readonly MIN_SIZE: number;
|
|
21
|
+
/**
|
|
22
|
+
* The thickness of the base of the tail in relation to the size of the
|
|
23
|
+
* bubble. Higher numbers result in thinner tails.
|
|
24
|
+
*/
|
|
25
|
+
static readonly TAIL_THICKNESS = 1;
|
|
26
|
+
/** The number of degrees that the tail bends counter-clockwise. */
|
|
27
|
+
static readonly TAIL_ANGLE = 20;
|
|
28
|
+
/**
|
|
29
|
+
* The sharpness of the tail's bend. Higher numbers result in smoother
|
|
30
|
+
* tails.
|
|
31
|
+
*/
|
|
32
|
+
static readonly TAIL_BEND = 4;
|
|
33
|
+
/** Distance between arrow point and anchor point. */
|
|
34
|
+
static readonly ANCHOR_RADIUS = 8;
|
|
35
|
+
/** The SVG group containing all parts of the bubble. */
|
|
36
|
+
protected svgRoot: SVGGElement;
|
|
37
|
+
/** The SVG path for the arrow from the anchor to the bubble. */
|
|
38
|
+
private tail;
|
|
39
|
+
/** The SVG background rect for the main body of the bubble. */
|
|
40
|
+
private background;
|
|
41
|
+
/** The SVG group containing the contents of the bubble. */
|
|
42
|
+
protected contentContainer: SVGGElement;
|
|
43
|
+
/**
|
|
44
|
+
* The size of the bubble (including background and contents but not tail).
|
|
45
|
+
*/
|
|
46
|
+
private size;
|
|
47
|
+
/** The colour of the background of the bubble. */
|
|
48
|
+
private colour;
|
|
49
|
+
/** True if the bubble has been disposed, false otherwise. */
|
|
50
|
+
disposed: boolean;
|
|
51
|
+
/** The position of the top of the bubble relative to its anchor. */
|
|
52
|
+
private relativeTop;
|
|
53
|
+
/** The position of the left of the bubble realtive to its anchor. */
|
|
54
|
+
private relativeLeft;
|
|
55
|
+
/**
|
|
56
|
+
* @param workspace The workspace this bubble belongs to.
|
|
57
|
+
* @param anchor The anchor location of the thing this bubble is attached to.
|
|
58
|
+
* The tail of the bubble will point to this location.
|
|
59
|
+
* @param ownerRect An optional rect we don't want the bubble to overlap with
|
|
60
|
+
* when automatically positioning.
|
|
61
|
+
*/
|
|
62
|
+
constructor(workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
|
|
63
|
+
/** Dispose of this bubble. */
|
|
64
|
+
dispose(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Set the location the tail of this bubble points to.
|
|
67
|
+
*
|
|
68
|
+
* @param anchor The location the tail of this bubble points to.
|
|
69
|
+
* @param relayout If true, reposition the bubble from scratch so that it is
|
|
70
|
+
* optimally visible. If false, reposition it so it maintains the same
|
|
71
|
+
* position relative to the anchor.
|
|
72
|
+
*/
|
|
73
|
+
setAnchorLocation(anchor: Coordinate, relayout?: boolean): void;
|
|
74
|
+
/** Sets the position of this bubble relative to its anchor. */
|
|
75
|
+
setPositionRelativeToAnchor(left: number, top: number): void;
|
|
76
|
+
/** @returns the size of this bubble. */
|
|
77
|
+
protected getSize(): Size;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the size of this bubble, including the border.
|
|
80
|
+
*
|
|
81
|
+
* @param size Sets the size of this bubble, including the border.
|
|
82
|
+
* @param relayout If true, reposition the bubble from scratch so that it is
|
|
83
|
+
* optimally visible. If false, reposition it so it maintains the same
|
|
84
|
+
* position relative to the anchor.
|
|
85
|
+
*/
|
|
86
|
+
protected setSize(size: Size, relayout?: boolean): void;
|
|
87
|
+
/** Returns the colour of the background and tail of this bubble. */
|
|
88
|
+
protected getColour(): string;
|
|
89
|
+
/** Sets the colour of the background and tail of this bubble. */
|
|
90
|
+
setColour(colour: string): void;
|
|
91
|
+
/** Passes the pointer event off to the gesture system. */
|
|
92
|
+
private onMouseDown;
|
|
93
|
+
/** Positions the bubble relative to its anchor. Does not render its tail. */
|
|
94
|
+
protected positionRelativeToAnchor(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Moves the bubble to the given coordinates.
|
|
97
|
+
*
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
moveTo(x: number, y: number): void;
|
|
101
|
+
/**
|
|
102
|
+
* Positions the bubble "optimally" so that the most of it is visible and
|
|
103
|
+
* it does not overlap the rect (if provided).
|
|
104
|
+
*/
|
|
105
|
+
protected positionByRect(rect?: Rect): void;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate the what percentage of the bubble overlaps with the visible
|
|
108
|
+
* workspace (what percentage of the bubble is visible).
|
|
109
|
+
*
|
|
110
|
+
* @param relativeMin The position of the top-left corner of the bubble
|
|
111
|
+
* relative to the anchor point.
|
|
112
|
+
* @param viewMetrics The view metrics of the workspace the bubble will appear
|
|
113
|
+
* in.
|
|
114
|
+
* @returns The percentage of the bubble that is visible.
|
|
115
|
+
*/
|
|
116
|
+
private getOverlap;
|
|
117
|
+
/**
|
|
118
|
+
* Calculate what the optimal horizontal position of the top-left corner of
|
|
119
|
+
* the bubble is (relative to the anchor point) so that the most area of the
|
|
120
|
+
* bubble is shown.
|
|
121
|
+
*
|
|
122
|
+
* @param viewMetrics The view metrics of the workspace the bubble will appear
|
|
123
|
+
* in.
|
|
124
|
+
* @returns The optimal horizontal position of the top-left corner of the
|
|
125
|
+
* bubble.
|
|
126
|
+
*/
|
|
127
|
+
private getOptimalRelativeLeft;
|
|
128
|
+
/**
|
|
129
|
+
* Calculate what the optimal vertical position of the top-left corner of
|
|
130
|
+
* the bubble is (relative to the anchor point) so that the most area of the
|
|
131
|
+
* bubble is shown.
|
|
132
|
+
*
|
|
133
|
+
* @param viewMetrics The view metrics of the workspace the bubble will appear
|
|
134
|
+
* in.
|
|
135
|
+
* @returns The optimal vertical position of the top-left corner of the
|
|
136
|
+
* bubble.
|
|
137
|
+
*/
|
|
138
|
+
private getOptimalRelativeTop;
|
|
139
|
+
/**
|
|
140
|
+
* @returns a rect defining the bounds of the workspace's view in workspace
|
|
141
|
+
* coordinates.
|
|
142
|
+
*/
|
|
143
|
+
private getWorkspaceViewRect;
|
|
144
|
+
/** @returns the scrollbar thickness in workspace units. */
|
|
145
|
+
private getScrollbarThickness;
|
|
146
|
+
/** Draws the tail of the bubble. */
|
|
147
|
+
private renderTail;
|
|
148
|
+
/**
|
|
149
|
+
* Move this bubble to the front of the visible workspace.
|
|
150
|
+
*
|
|
151
|
+
* @returns Whether or not the bubble has been moved.
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
bringToFront(): boolean;
|
|
155
|
+
/** @internal */
|
|
156
|
+
getRelativeToSurfaceXY(): Coordinate;
|
|
157
|
+
/** @internal */
|
|
158
|
+
getSvgRoot(): SVGElement;
|
|
159
|
+
/**
|
|
160
|
+
* Move this bubble during a drag.
|
|
161
|
+
*
|
|
162
|
+
* @param newLoc The location to translate to, in workspace coordinates.
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
moveDuringDrag(newLoc: Coordinate): void;
|
|
166
|
+
setDragging(_start: boolean): void;
|
|
167
|
+
/** @internal */
|
|
168
|
+
setDeleteStyle(_enable: boolean): void;
|
|
169
|
+
/** @internal */
|
|
170
|
+
isDeletable(): boolean;
|
|
171
|
+
/** @internal */
|
|
172
|
+
showContextMenu(_e: Event): void;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=bubble.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Abstract as AbstractEvent } from '../events/events_abstract.js';
|
|
7
|
+
import type { BlocklyOptions } from '../blockly_options.js';
|
|
8
|
+
import { Bubble } from './bubble.js';
|
|
9
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
10
|
+
import { Options } from '../options.js';
|
|
11
|
+
import type { Rect } from '../utils/rect.js';
|
|
12
|
+
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
13
|
+
export declare class MiniWorkspaceBubble extends Bubble {
|
|
14
|
+
protected readonly workspace: WorkspaceSvg;
|
|
15
|
+
protected anchor: Coordinate;
|
|
16
|
+
protected ownerRect?: Rect | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The minimum amount of change to the mini workspace view to trigger
|
|
19
|
+
* resizing the bubble.
|
|
20
|
+
*/
|
|
21
|
+
private static readonly MINIMUM_VIEW_CHANGE;
|
|
22
|
+
/**
|
|
23
|
+
* An arbitrary margin of whitespace to put around the blocks in the
|
|
24
|
+
* workspace.
|
|
25
|
+
*/
|
|
26
|
+
private static readonly MARGIN;
|
|
27
|
+
/** The root svg element containing the workspace. */
|
|
28
|
+
private svgDialog;
|
|
29
|
+
/** The workspace that gets shown within this bubble. */
|
|
30
|
+
private miniWorkspace;
|
|
31
|
+
/**
|
|
32
|
+
* Should this bubble automatically reposition itself when it resizes?
|
|
33
|
+
* Becomes false after this bubble is first dragged.
|
|
34
|
+
*/
|
|
35
|
+
private autoLayout;
|
|
36
|
+
/** @internal */
|
|
37
|
+
constructor(workspaceOptions: BlocklyOptions, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
|
|
38
|
+
dispose(): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
getWorkspace(): WorkspaceSvg;
|
|
41
|
+
/** Adds a change listener to the mini workspace. */
|
|
42
|
+
addWorkspaceChangeListener(listener: (e: AbstractEvent) => void): void;
|
|
43
|
+
/**
|
|
44
|
+
* Validates the workspace options to make sure folks aren't trying to
|
|
45
|
+
* enable things the miniworkspace doesn't support.
|
|
46
|
+
*/
|
|
47
|
+
private validateWorkspaceOptions;
|
|
48
|
+
private onWorkspaceChange;
|
|
49
|
+
/**
|
|
50
|
+
* Bumps blocks that are above the top or outside the start-side of the
|
|
51
|
+
* workspace back within the workspace.
|
|
52
|
+
*
|
|
53
|
+
* Blocks that are below the bottom or outside the end-side of the workspace
|
|
54
|
+
* are dealt with by resizing the workspace to show them.
|
|
55
|
+
*/
|
|
56
|
+
private bumpBlocksIntoBounds;
|
|
57
|
+
/**
|
|
58
|
+
* Updates the size of this bubble to account for the size of the
|
|
59
|
+
* mini workspace.
|
|
60
|
+
*/
|
|
61
|
+
private updateBubbleSize;
|
|
62
|
+
/**
|
|
63
|
+
* Calculates the size of the mini workspace for use in resizing the bubble.
|
|
64
|
+
*/
|
|
65
|
+
private calculateWorkspaceSize;
|
|
66
|
+
/** Reapplies styles to all of the blocks in the mini workspace. */
|
|
67
|
+
updateBlockStyles(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Move this bubble during a drag.
|
|
70
|
+
*
|
|
71
|
+
* @param newLoc The location to translate to, in workspace coordinates.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
moveDuringDrag(newLoc: Coordinate): void;
|
|
75
|
+
/** @internal */
|
|
76
|
+
moveTo(x: number, y: number): void;
|
|
77
|
+
/** @internal */
|
|
78
|
+
newWorkspaceSvg(options: Options): WorkspaceSvg;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=mini_workspace_bubble.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Bubble } from './bubble.js';
|
|
7
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
8
|
+
import { Rect } from '../utils/rect.js';
|
|
9
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
10
|
+
export declare class TextBubble extends Bubble {
|
|
11
|
+
private text;
|
|
12
|
+
protected readonly workspace: WorkspaceSvg;
|
|
13
|
+
protected anchor: Coordinate;
|
|
14
|
+
protected ownerRect?: Rect | undefined;
|
|
15
|
+
private paragraph;
|
|
16
|
+
constructor(text: string, workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
|
|
17
|
+
/** @returns the current text of this text bubble. */
|
|
18
|
+
getText(): string;
|
|
19
|
+
/** Sets the current text of this text bubble, and updates the display. */
|
|
20
|
+
setText(text: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Converts the given string into an svg containing that string,
|
|
23
|
+
* broken up by newlines.
|
|
24
|
+
*/
|
|
25
|
+
private stringToSvg;
|
|
26
|
+
/** Creates the paragraph container for this bubble's view's spans. */
|
|
27
|
+
private createParagraph;
|
|
28
|
+
/** Creates the spans visualizing the text of this bubble. */
|
|
29
|
+
private createSpans;
|
|
30
|
+
/** Right aligns the given spans. */
|
|
31
|
+
private rightAlignSpans;
|
|
32
|
+
/** Updates the size of this bubble to account for the size of the text. */
|
|
33
|
+
private updateBubbleSize;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=text_bubble.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Bubble } from './bubble.js';
|
|
7
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
8
|
+
import { Rect } from '../utils/rect.js';
|
|
9
|
+
import { Size } from '../utils/size.js';
|
|
10
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
11
|
+
export declare class TextInputBubble extends Bubble {
|
|
12
|
+
protected readonly workspace: WorkspaceSvg;
|
|
13
|
+
protected anchor: Coordinate;
|
|
14
|
+
protected ownerRect?: Rect | undefined;
|
|
15
|
+
/** The root of the elements specific to the text element. */
|
|
16
|
+
private inputRoot;
|
|
17
|
+
/** The text input area element. */
|
|
18
|
+
private textArea;
|
|
19
|
+
/** The group containing the lines indicating the bubble is resizable. */
|
|
20
|
+
private resizeGroup;
|
|
21
|
+
/**
|
|
22
|
+
* Event data associated with the listener for pointer up events on the
|
|
23
|
+
* resize group.
|
|
24
|
+
*/
|
|
25
|
+
private resizePointerUpListener;
|
|
26
|
+
/**
|
|
27
|
+
* Event data associated with the listener for pointer move events on the
|
|
28
|
+
* resize group.
|
|
29
|
+
*/
|
|
30
|
+
private resizePointerMoveListener;
|
|
31
|
+
/** Functions listening for changes to the text of this bubble. */
|
|
32
|
+
private textChangeListeners;
|
|
33
|
+
/** Functions listening for changes to the size of this bubble. */
|
|
34
|
+
private sizeChangeListeners;
|
|
35
|
+
/** The text of this bubble. */
|
|
36
|
+
private text;
|
|
37
|
+
/** The default size of this bubble, including borders. */
|
|
38
|
+
private readonly DEFAULT_SIZE;
|
|
39
|
+
/** The minimum size of this bubble, including borders. */
|
|
40
|
+
private readonly MIN_SIZE;
|
|
41
|
+
/**
|
|
42
|
+
* @param workspace The workspace this bubble belongs to.
|
|
43
|
+
* @param anchor The anchor location of the thing this bubble is attached to.
|
|
44
|
+
* The tail of the bubble will point to this location.
|
|
45
|
+
* @param ownerRect An optional rect we don't want the bubble to overlap with
|
|
46
|
+
* when automatically positioning.
|
|
47
|
+
*/
|
|
48
|
+
constructor(workspace: WorkspaceSvg, anchor: Coordinate, ownerRect?: Rect | undefined);
|
|
49
|
+
/** @returns the text of this bubble. */
|
|
50
|
+
getText(): string;
|
|
51
|
+
/** Sets the text of this bubble. Calls change listeners. */
|
|
52
|
+
setText(text: string): void;
|
|
53
|
+
/** Adds a change listener to be notified when this bubble's text changes. */
|
|
54
|
+
addTextChangeListener(listener: () => void): void;
|
|
55
|
+
/** Adds a change listener to be notified when this bubble's size changes. */
|
|
56
|
+
addSizeChangeListener(listener: () => void): void;
|
|
57
|
+
/** Creates the editor UI for this bubble. */
|
|
58
|
+
private createEditor;
|
|
59
|
+
/** Binds events to the text area element. */
|
|
60
|
+
private bindTextAreaEvents;
|
|
61
|
+
/** Creates the resize handler elements and binds events to them. */
|
|
62
|
+
private createResizeHandle;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the size of this bubble, including the border.
|
|
65
|
+
*
|
|
66
|
+
* @param size Sets the size of this bubble, including the border.
|
|
67
|
+
* @param relayout If true, reposition the bubble from scratch so that it is
|
|
68
|
+
* optimally visible. If false, reposition it so it maintains the same
|
|
69
|
+
* position relative to the anchor.
|
|
70
|
+
*/
|
|
71
|
+
setSize(size: Size, relayout?: boolean): void;
|
|
72
|
+
/** @returns the size of this bubble. */
|
|
73
|
+
getSize(): Size;
|
|
74
|
+
/** Handles mouse down events on the resize target. */
|
|
75
|
+
private onResizePointerDown;
|
|
76
|
+
/** Handles pointer up events on the resize target. */
|
|
77
|
+
private onResizePointerUp;
|
|
78
|
+
/** Handles pointer move events on the resize target. */
|
|
79
|
+
private onResizePointerMove;
|
|
80
|
+
/**
|
|
81
|
+
* Handles starting an edit of the text area. Brings the bubble to the front.
|
|
82
|
+
*/
|
|
83
|
+
private onStartEdit;
|
|
84
|
+
/** Handles a text change event for the text area. Calls event listeners. */
|
|
85
|
+
private onTextChange;
|
|
86
|
+
/** Handles a size change event for the text area. Calls event listeners. */
|
|
87
|
+
private onSizeChange;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=textinput_bubble.d.ts.map
|
package/core/bump_objects.d.ts
CHANGED
|
@@ -11,12 +11,14 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
11
11
|
* Bumps the given object that has passed out of bounds.
|
|
12
12
|
*
|
|
13
13
|
* @param workspace The workspace containing the object.
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
14
|
+
* @param bounds The region to bump an object into. For example, pass
|
|
15
|
+
* ScrollMetrics to bump a block into the scrollable region of the
|
|
16
|
+
* workspace, or pass ViewMetrics to bump a block into the visible region of
|
|
17
|
+
* the workspace. This should be specified in workspace coordinates.
|
|
16
18
|
* @param object The object to bump.
|
|
17
|
-
* @returns True if
|
|
19
|
+
* @returns True if object was bumped.
|
|
18
20
|
*/
|
|
19
|
-
declare function bumpObjectIntoBounds(workspace: WorkspaceSvg,
|
|
21
|
+
declare function bumpObjectIntoBounds(workspace: WorkspaceSvg, bounds: ContainerRegion, object: IBoundedElement): boolean;
|
|
20
22
|
export declare const bumpIntoBounds: typeof bumpObjectIntoBounds;
|
|
21
23
|
/**
|
|
22
24
|
* Creates a handler for bumping objects when they cross fixed bounds.
|
package/core/connection.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Block } from './block.js';
|
|
7
|
-
import type { Input } from './input.js';
|
|
7
|
+
import type { Input } from './inputs/input.js';
|
|
8
8
|
import type { IASTNodeLocationWithBlock } from './interfaces/i_ast_node_location_with_block.js';
|
|
9
9
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
10
10
|
import * as blocks from './serialization/blocks.js';
|
|
@@ -33,9 +33,9 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
33
33
|
*/
|
|
34
34
|
disposed: boolean;
|
|
35
35
|
/** List of compatible value types. Null if all types are compatible. */
|
|
36
|
-
private
|
|
36
|
+
private check;
|
|
37
37
|
/** DOM representation of a shadow block, or null if none. */
|
|
38
|
-
private
|
|
38
|
+
private shadowDom;
|
|
39
39
|
/**
|
|
40
40
|
* Horizontal location of this connection.
|
|
41
41
|
*
|
|
@@ -48,7 +48,7 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
48
48
|
* @internal
|
|
49
49
|
*/
|
|
50
50
|
y: number;
|
|
51
|
-
private
|
|
51
|
+
private shadowState;
|
|
52
52
|
/**
|
|
53
53
|
* @param source The block establishing this connection.
|
|
54
54
|
* @param type The type of the connection.
|
|
@@ -137,6 +137,16 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
137
137
|
* Respawn the shadow block if there was one connected to the this connection.
|
|
138
138
|
*/
|
|
139
139
|
protected respawnShadow_(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Reconnects this connection to the input with the given name on the given
|
|
142
|
+
* block. If there is already a connection connected to that input, that
|
|
143
|
+
* connection is disconnected.
|
|
144
|
+
*
|
|
145
|
+
* @param block The block to connect this connection to.
|
|
146
|
+
* @param inputName The name of the input to connect this connection to.
|
|
147
|
+
* @returns True if this connection was able to connect, false otherwise.
|
|
148
|
+
*/
|
|
149
|
+
reconnect(block: Block, inputName: string): boolean;
|
|
140
150
|
/**
|
|
141
151
|
* Returns the block that this connection connects to.
|
|
142
152
|
*
|
|
@@ -230,20 +240,20 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
230
240
|
*
|
|
231
241
|
* @returns The state of both the shadowDom_ and shadowState_ properties.
|
|
232
242
|
*/
|
|
233
|
-
private
|
|
243
|
+
private stashShadowState;
|
|
234
244
|
/**
|
|
235
245
|
* Reapplies the stashed state of the shadowDom_ and shadowState_ properties.
|
|
236
246
|
*
|
|
237
247
|
* @param param0 The state to reapply to the shadowDom_ and shadowState_
|
|
238
248
|
* properties.
|
|
239
249
|
*/
|
|
240
|
-
private
|
|
250
|
+
private applyShadowState;
|
|
241
251
|
/**
|
|
242
252
|
* Sets the state of the shadow of this connection.
|
|
243
253
|
*
|
|
244
254
|
* @param param0 The state to set the shadow of this connection to.
|
|
245
255
|
*/
|
|
246
|
-
private
|
|
256
|
+
private setShadowStateInternal;
|
|
247
257
|
/**
|
|
248
258
|
* Creates a shadow block based on the current shadowState_ or shadowDom_.
|
|
249
259
|
* shadowState_ gets priority.
|
|
@@ -253,14 +263,14 @@ export declare class Connection implements IASTNodeLocationWithBlock {
|
|
|
253
263
|
* @returns The shadow block that was created, or null if both the
|
|
254
264
|
* shadowState_ and shadowDom_ are null.
|
|
255
265
|
*/
|
|
256
|
-
private
|
|
266
|
+
private createShadowBlock;
|
|
257
267
|
/**
|
|
258
268
|
* Saves the given shadow block to both the shadowDom_ and shadowState_
|
|
259
269
|
* properties, in their respective serialized forms.
|
|
260
270
|
*
|
|
261
271
|
* @param shadow The shadow to serialize, or null.
|
|
262
272
|
*/
|
|
263
|
-
private
|
|
273
|
+
private serializeShadow;
|
|
264
274
|
/**
|
|
265
275
|
* Returns the connection (starting at the startBlock) which will accept
|
|
266
276
|
* the given connection. This includes compatible connection types and
|
package/core/connection_db.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { Coordinate } from './utils/coordinate.js';
|
|
|
14
14
|
export declare class ConnectionDB {
|
|
15
15
|
private readonly connectionChecker;
|
|
16
16
|
/** Array of connections sorted by y position in workspace units. */
|
|
17
|
-
private readonly
|
|
17
|
+
private readonly connections;
|
|
18
18
|
/**
|
|
19
19
|
* @param connectionChecker The workspace's connection type checker, used to
|
|
20
20
|
* decide if connections are valid during a drag.
|
|
@@ -39,14 +39,14 @@ export declare class ConnectionDB {
|
|
|
39
39
|
* @returns The index of the connection, or -1 if the connection was not
|
|
40
40
|
* found.
|
|
41
41
|
*/
|
|
42
|
-
private
|
|
42
|
+
private findIndexOfConnection;
|
|
43
43
|
/**
|
|
44
44
|
* Finds the correct index for the given y position.
|
|
45
45
|
*
|
|
46
46
|
* @param yPos The y position used to decide where to insert the connection.
|
|
47
47
|
* @returns The candidate index.
|
|
48
48
|
*/
|
|
49
|
-
private
|
|
49
|
+
private calculateIndexForYPos;
|
|
50
50
|
/**
|
|
51
51
|
* Remove a connection from the database. Must already exist in DB.
|
|
52
52
|
*
|
|
@@ -73,7 +73,7 @@ export declare class ConnectionDB {
|
|
|
73
73
|
* @param maxRadius The maximum radius to another connection.
|
|
74
74
|
* @returns True if connection is in range.
|
|
75
75
|
*/
|
|
76
|
-
private
|
|
76
|
+
private isInYRange;
|
|
77
77
|
/**
|
|
78
78
|
* Find the closest compatible connection to this connection.
|
|
79
79
|
*
|
package/core/contextmenu.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare function dispose(): void;
|
|
|
43
43
|
* @param xml XML representation of new block.
|
|
44
44
|
* @returns Function that creates a block.
|
|
45
45
|
*/
|
|
46
|
-
export declare function callbackFactory(block: Block, xml: Element):
|
|
46
|
+
export declare function callbackFactory(block: Block, xml: Element): () => void;
|
|
47
47
|
/**
|
|
48
48
|
* Make a context menu option for deleting the current workspace comment.
|
|
49
49
|
*
|
|
@@ -71,7 +71,6 @@ export declare function commentDuplicateOption(comment: WorkspaceCommentSvg): Le
|
|
|
71
71
|
* originated.
|
|
72
72
|
* @param e The right-click mouse event.
|
|
73
73
|
* @returns A menu option, containing text, enabled, and a callback.
|
|
74
|
-
* @suppress {strictModuleDepCheck,checkTypes} Suppress checks while workspace
|
|
75
74
|
* comments are not bundled in.
|
|
76
75
|
* @internal
|
|
77
76
|
*/
|
package/core/events/events.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { Selected, SelectedJson } from './events_selected.js';
|
|
|
22
22
|
import { ThemeChange, ThemeChangeJson } from './events_theme_change.js';
|
|
23
23
|
import { ToolboxItemSelect, ToolboxItemSelectJson } from './events_toolbox_item_select.js';
|
|
24
24
|
import { TrashcanOpen, TrashcanOpenJson } from './events_trashcan_open.js';
|
|
25
|
-
import { Ui } from './events_ui.js';
|
|
26
25
|
import { UiBase } from './events_ui_base.js';
|
|
27
26
|
import { VarBase, VarBaseJson } from './events_var_base.js';
|
|
28
27
|
import { VarCreate, VarCreateJson } from './events_var_create.js';
|
|
@@ -30,7 +29,7 @@ import { VarDelete, VarDeleteJson } from './events_var_delete.js';
|
|
|
30
29
|
import { VarRename, VarRenameJson } from './events_var_rename.js';
|
|
31
30
|
import { ViewportChange, ViewportChangeJson } from './events_viewport.js';
|
|
32
31
|
import * as eventUtils from './utils.js';
|
|
33
|
-
import { FinishedLoading
|
|
32
|
+
import { FinishedLoading } from './workspace_events.js';
|
|
34
33
|
export { Abstract };
|
|
35
34
|
export { AbstractEventJson };
|
|
36
35
|
export { BubbleOpen };
|
|
@@ -61,7 +60,6 @@ export { CommentDelete };
|
|
|
61
60
|
export { CommentMove };
|
|
62
61
|
export { CommentMoveJson };
|
|
63
62
|
export { FinishedLoading };
|
|
64
|
-
export { FinishedLoadingJson };
|
|
65
63
|
export { MarkerMove };
|
|
66
64
|
export { MarkerMoveJson };
|
|
67
65
|
export { Selected };
|
|
@@ -72,7 +70,6 @@ export { ToolboxItemSelect };
|
|
|
72
70
|
export { ToolboxItemSelectJson };
|
|
73
71
|
export { TrashcanOpen };
|
|
74
72
|
export { TrashcanOpenJson };
|
|
75
|
-
export { Ui };
|
|
76
73
|
export { UiBase };
|
|
77
74
|
export { VarBase };
|
|
78
75
|
export { VarBaseJson };
|
|
@@ -35,12 +35,6 @@ export declare abstract class Abstract {
|
|
|
35
35
|
* @returns JSON representation.
|
|
36
36
|
*/
|
|
37
37
|
toJson(): AbstractEventJson;
|
|
38
|
-
/**
|
|
39
|
-
* Decode the JSON event.
|
|
40
|
-
*
|
|
41
|
-
* @param json JSON representation.
|
|
42
|
-
*/
|
|
43
|
-
fromJson(json: AbstractEventJson): void;
|
|
44
38
|
/**
|
|
45
39
|
* Deserializes the JSON event.
|
|
46
40
|
*
|
|
@@ -24,12 +24,6 @@ export declare class BlockBase extends AbstractEvent {
|
|
|
24
24
|
* @returns JSON representation.
|
|
25
25
|
*/
|
|
26
26
|
toJson(): BlockBaseJson;
|
|
27
|
-
/**
|
|
28
|
-
* Decode the JSON event.
|
|
29
|
-
*
|
|
30
|
-
* @param json JSON representation.
|
|
31
|
-
*/
|
|
32
|
-
fromJson(json: BlockBaseJson): void;
|
|
33
27
|
/**
|
|
34
28
|
* Deserializes the JSON event.
|
|
35
29
|
*
|
|
@@ -38,12 +38,6 @@ export declare class BlockChange extends BlockBase {
|
|
|
38
38
|
* @returns JSON representation.
|
|
39
39
|
*/
|
|
40
40
|
toJson(): BlockChangeJson;
|
|
41
|
-
/**
|
|
42
|
-
* Decode the JSON event.
|
|
43
|
-
*
|
|
44
|
-
* @param json JSON representation.
|
|
45
|
-
*/
|
|
46
|
-
fromJson(json: BlockChangeJson): void;
|
|
47
41
|
/**
|
|
48
42
|
* Deserializes the JSON event.
|
|
49
43
|
*
|
|
@@ -27,12 +27,6 @@ export declare class BlockCreate extends BlockBase {
|
|
|
27
27
|
* @returns JSON representation.
|
|
28
28
|
*/
|
|
29
29
|
toJson(): BlockCreateJson;
|
|
30
|
-
/**
|
|
31
|
-
* Decode the JSON event.
|
|
32
|
-
*
|
|
33
|
-
* @param json JSON representation.
|
|
34
|
-
*/
|
|
35
|
-
fromJson(json: BlockCreateJson): void;
|
|
36
30
|
/**
|
|
37
31
|
* Deserializes the JSON event.
|
|
38
32
|
*
|