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
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2024 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { IRenderedElement } from '../interfaces/i_rendered_element.js';
|
|
7
|
-
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
8
|
-
import { Coordinate, Size } from '../utils.js';
|
|
9
|
-
export declare class CommentView implements IRenderedElement {
|
|
10
|
-
private readonly workspace;
|
|
11
|
-
/** The root group element of the comment view. */
|
|
12
|
-
private svgRoot;
|
|
13
|
-
/** The rect background for the top bar. */
|
|
14
|
-
private topBar;
|
|
15
|
-
/** The delete icon that goes in the top bar. */
|
|
16
|
-
private deleteIcon;
|
|
17
|
-
/** The foldout icon that goes in the top bar. */
|
|
18
|
-
private foldoutIcon;
|
|
19
|
-
/** The text element that goes in the top bar. */
|
|
20
|
-
private textPreview;
|
|
21
|
-
/** The actual text node in the text preview. */
|
|
22
|
-
private textPreviewNode;
|
|
23
|
-
/** The resize handle element. */
|
|
24
|
-
private resizeHandle;
|
|
25
|
-
/** The foreignObject containing the HTML text area. */
|
|
26
|
-
private foreignObject;
|
|
27
|
-
/** The text area where the user can type. */
|
|
28
|
-
private textArea;
|
|
29
|
-
/** The current size of the comment in workspace units. */
|
|
30
|
-
private size;
|
|
31
|
-
/** Whether the comment is collapsed or not. */
|
|
32
|
-
private collapsed;
|
|
33
|
-
/** Whether the comment is editable or not. */
|
|
34
|
-
private editable;
|
|
35
|
-
/** The current location of the comment in workspace coordinates. */
|
|
36
|
-
private location;
|
|
37
|
-
/** The current text of the comment. Updates on text area change. */
|
|
38
|
-
private text;
|
|
39
|
-
/** Listeners for changes to text. */
|
|
40
|
-
private textChangeListeners;
|
|
41
|
-
/** Listeners for changes to size. */
|
|
42
|
-
private sizeChangeListeners;
|
|
43
|
-
/** Listeners for disposal. */
|
|
44
|
-
private disposeListeners;
|
|
45
|
-
/** Listeners for collapsing. */
|
|
46
|
-
private collapseChangeListeners;
|
|
47
|
-
/**
|
|
48
|
-
* Event data for the pointer up event on the resize handle. Used to
|
|
49
|
-
* unregister the listener.
|
|
50
|
-
*/
|
|
51
|
-
private resizePointerUpListener;
|
|
52
|
-
/**
|
|
53
|
-
* Event data for the pointer move event on the resize handle. Used to
|
|
54
|
-
* unregister the listener.
|
|
55
|
-
*/
|
|
56
|
-
private resizePointerMoveListener;
|
|
57
|
-
/** Whether this comment view is currently being disposed or not. */
|
|
58
|
-
private disposing;
|
|
59
|
-
/** Whether this comment view has been disposed or not. */
|
|
60
|
-
private disposed;
|
|
61
|
-
constructor(workspace: WorkspaceSvg);
|
|
62
|
-
/**
|
|
63
|
-
* Creates the top bar and the elements visually within it.
|
|
64
|
-
* Registers event listeners.
|
|
65
|
-
*/
|
|
66
|
-
private createTopBar;
|
|
67
|
-
/**
|
|
68
|
-
* Creates the text area where users can type. Registers event listeners.
|
|
69
|
-
*/
|
|
70
|
-
private createTextArea;
|
|
71
|
-
/** Creates the DOM elements for the comment resize handle. */
|
|
72
|
-
private createResizeHandle;
|
|
73
|
-
/** Returns the root SVG group element of the comment view. */
|
|
74
|
-
getSvgRoot(): SVGGElement;
|
|
75
|
-
/** Returns the current size of the comment in workspace units. */
|
|
76
|
-
getSize(): Size;
|
|
77
|
-
/**
|
|
78
|
-
* Sets the size of the comment in workspace units, and updates the view
|
|
79
|
-
* elements to reflect the new size.
|
|
80
|
-
*/
|
|
81
|
-
setSize(size: Size): void;
|
|
82
|
-
/**
|
|
83
|
-
* Calculates the minimum size for the uncollapsed comment based on text
|
|
84
|
-
* size and visible icons.
|
|
85
|
-
*
|
|
86
|
-
* The minimum width is based on the width of the truncated preview text.
|
|
87
|
-
*
|
|
88
|
-
* The minimum height is based on the height of the top bar.
|
|
89
|
-
*/
|
|
90
|
-
private calcMinSize;
|
|
91
|
-
/** Calculates the margin that should exist around the delete icon. */
|
|
92
|
-
private calcDeleteMargin;
|
|
93
|
-
/** Calculates the margin that should exist around the foldout icon. */
|
|
94
|
-
private calcFoldoutMargin;
|
|
95
|
-
/** Updates the size of the text area elements to reflect the new size. */
|
|
96
|
-
private updateTextAreaSize;
|
|
97
|
-
/**
|
|
98
|
-
* Updates the position of the delete icon elements to reflect the new size.
|
|
99
|
-
*/
|
|
100
|
-
private updateDeleteIconPosition;
|
|
101
|
-
/**
|
|
102
|
-
* Updates the position of the foldout icon elements to reflect the new size.
|
|
103
|
-
*/
|
|
104
|
-
private updateFoldoutIconPosition;
|
|
105
|
-
/**
|
|
106
|
-
* Updates the size and position of the text preview elements to reflect the new size.
|
|
107
|
-
*/
|
|
108
|
-
private updateTextPreviewSize;
|
|
109
|
-
/**
|
|
110
|
-
* Triggers listeners when the size of the comment changes, either
|
|
111
|
-
* progrmatically or manually by the user.
|
|
112
|
-
*/
|
|
113
|
-
private onSizeChange;
|
|
114
|
-
/**
|
|
115
|
-
* Registers a callback that listens for size changes.
|
|
116
|
-
*
|
|
117
|
-
* @param listener Receives callbacks when the size of the comment changes.
|
|
118
|
-
* The new and old size are in workspace units.
|
|
119
|
-
*/
|
|
120
|
-
addSizeChangeListener(listener: (oldSize: Size, newSize: Size) => void): void;
|
|
121
|
-
/** Removes the given listener from the list of size change listeners. */
|
|
122
|
-
removeSizeChangeListener(listener: () => void): void;
|
|
123
|
-
/**
|
|
124
|
-
* Handles starting an interaction with the resize handle to resize the
|
|
125
|
-
* comment.
|
|
126
|
-
*/
|
|
127
|
-
private onResizePointerDown;
|
|
128
|
-
/** Ends an interaction with the resize handle. */
|
|
129
|
-
private onResizePointerUp;
|
|
130
|
-
/** Resizes the comment in response to a drag on the resize handle. */
|
|
131
|
-
private onResizePointerMove;
|
|
132
|
-
/** Returns true if the comment is currently collapsed. */
|
|
133
|
-
isCollapsed(): boolean;
|
|
134
|
-
/** Sets whether the comment is currently collapsed or not. */
|
|
135
|
-
setCollapsed(collapsed: boolean): void;
|
|
136
|
-
/**
|
|
137
|
-
* Triggers listeners when the collapsed-ness of the comment changes, either
|
|
138
|
-
* progrmatically or manually by the user.
|
|
139
|
-
*/
|
|
140
|
-
private onCollapse;
|
|
141
|
-
/** Registers a callback that listens for collapsed-ness changes. */
|
|
142
|
-
addOnCollapseListener(listener: (newCollapse: boolean) => void): void;
|
|
143
|
-
/** Removes the given listener from the list of on collapse listeners. */
|
|
144
|
-
removeOnCollapseListener(listener: () => void): void;
|
|
145
|
-
/**
|
|
146
|
-
* Toggles the collapsedness of the block when we receive a pointer down
|
|
147
|
-
* event on the foldout icon.
|
|
148
|
-
*/
|
|
149
|
-
private onFoldoutDown;
|
|
150
|
-
/** Returns true if the comment is currently editable. */
|
|
151
|
-
isEditable(): boolean;
|
|
152
|
-
/** Sets the editability of the comment. */
|
|
153
|
-
setEditable(editable: boolean): void;
|
|
154
|
-
/** Returns the current location of the comment in workspace coordinates. */
|
|
155
|
-
getRelativeToSurfaceXY(): Coordinate;
|
|
156
|
-
/**
|
|
157
|
-
* Moves the comment view to the given location.
|
|
158
|
-
*
|
|
159
|
-
* @param location The location to move to in workspace coordinates.
|
|
160
|
-
*/
|
|
161
|
-
moveTo(location: Coordinate): void;
|
|
162
|
-
/** Retursn the current text of the comment. */
|
|
163
|
-
getText(): string;
|
|
164
|
-
/** Sets the current text of the comment. */
|
|
165
|
-
setText(text: string): void;
|
|
166
|
-
/** Registers a callback that listens for text changes. */
|
|
167
|
-
addTextChangeListener(listener: (oldText: string, newText: string) => void): void;
|
|
168
|
-
/** Removes the given listener from the list of text change listeners. */
|
|
169
|
-
removeTextChangeListener(listener: () => void): void;
|
|
170
|
-
/**
|
|
171
|
-
* Triggers listeners when the text of the comment changes, either
|
|
172
|
-
* progrmatically or manually by the user.
|
|
173
|
-
*/
|
|
174
|
-
private onTextChange;
|
|
175
|
-
/** Updates the preview text element to reflect the given text. */
|
|
176
|
-
private updateTextPreview;
|
|
177
|
-
/** Truncates the text to fit within the top view. */
|
|
178
|
-
private truncateText;
|
|
179
|
-
/** Brings the workspace comment to the front of its layer. */
|
|
180
|
-
private bringToFront;
|
|
181
|
-
/**
|
|
182
|
-
* Handles disposing of the comment when we get a pointer down event on the
|
|
183
|
-
* delete icon.
|
|
184
|
-
*/
|
|
185
|
-
private onDeleteDown;
|
|
186
|
-
/** Disposes of this comment view. */
|
|
187
|
-
dispose(): void;
|
|
188
|
-
/** Returns whether this comment view has been disposed or not. */
|
|
189
|
-
isDisposed(): boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Returns true if this comment view is currently being disposed or has
|
|
192
|
-
* already been disposed.
|
|
193
|
-
*/
|
|
194
|
-
isDeadOrDying(): boolean;
|
|
195
|
-
/** Registers a callback that listens for disposal of this view. */
|
|
196
|
-
addDisposeListener(listener: () => void): void;
|
|
197
|
-
/** Removes the given listener from the list of disposal listeners. */
|
|
198
|
-
removeDisposeListener(listener: () => void): void;
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=comment_view.d.ts.map
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2024 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Workspace } from '../workspace.js';
|
|
7
|
-
import { Size } from '../utils/size.js';
|
|
8
|
-
import { Coordinate } from '../utils/coordinate.js';
|
|
9
|
-
export declare class WorkspaceComment {
|
|
10
|
-
protected readonly workspace: Workspace;
|
|
11
|
-
/** The unique identifier for this comment. */
|
|
12
|
-
readonly id: string;
|
|
13
|
-
/** The text of the comment. */
|
|
14
|
-
private text;
|
|
15
|
-
/** The size of the comment in workspace units. */
|
|
16
|
-
private size;
|
|
17
|
-
/** Whether the comment is collapsed or not. */
|
|
18
|
-
private collapsed;
|
|
19
|
-
/** Whether the comment is editable or not. */
|
|
20
|
-
private editable;
|
|
21
|
-
/** Whether the comment is movable or not. */
|
|
22
|
-
private movable;
|
|
23
|
-
/** Whether the comment is deletable or not. */
|
|
24
|
-
private deletable;
|
|
25
|
-
/** The location of the comment in workspace coordinates. */
|
|
26
|
-
private location;
|
|
27
|
-
/** Whether this comment has been disposed or not. */
|
|
28
|
-
private disposed;
|
|
29
|
-
/**
|
|
30
|
-
* Constructs the comment.
|
|
31
|
-
*
|
|
32
|
-
* @param workspace The workspace to construct the comment in.
|
|
33
|
-
* @param id An optional ID to give to the comment. If not provided, one will
|
|
34
|
-
* be generated.
|
|
35
|
-
*/
|
|
36
|
-
constructor(workspace: Workspace, id?: string);
|
|
37
|
-
/** Sets the text of the comment. */
|
|
38
|
-
setText(text: string): void;
|
|
39
|
-
/** Returns the text of the comment. */
|
|
40
|
-
getText(): string;
|
|
41
|
-
/** Sets the comment's size in workspace units. */
|
|
42
|
-
setSize(size: Size): void;
|
|
43
|
-
/** Returns the comment's size in workspace units. */
|
|
44
|
-
getSize(): Size;
|
|
45
|
-
/** Sets whether the comment is collapsed or not. */
|
|
46
|
-
setCollapsed(collapsed: boolean): void;
|
|
47
|
-
/** Returns whether the comment is collapsed or not. */
|
|
48
|
-
isCollapsed(): boolean;
|
|
49
|
-
/** Sets whether the comment is editable or not. */
|
|
50
|
-
setEditable(editable: boolean): void;
|
|
51
|
-
/**
|
|
52
|
-
* Returns whether the comment is editable or not, respecting whether the
|
|
53
|
-
* workspace is read-only.
|
|
54
|
-
*/
|
|
55
|
-
isEditable(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Returns whether the comment is editable or not, only examining its own
|
|
58
|
-
* state and ignoring the state of the workspace.
|
|
59
|
-
*/
|
|
60
|
-
isOwnEditable(): boolean;
|
|
61
|
-
/** Sets whether the comment is movable or not. */
|
|
62
|
-
setMovable(movable: boolean): void;
|
|
63
|
-
/**
|
|
64
|
-
* Returns whether the comment is movable or not, respecting whether the
|
|
65
|
-
* workspace is read-only.
|
|
66
|
-
*/
|
|
67
|
-
isMovable(): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Returns whether the comment is movable or not, only examining its own
|
|
70
|
-
* state and ignoring the state of the workspace.
|
|
71
|
-
*/
|
|
72
|
-
isOwnMovable(): boolean;
|
|
73
|
-
/** Sets whether the comment is deletable or not. */
|
|
74
|
-
setDeletable(deletable: boolean): void;
|
|
75
|
-
/**
|
|
76
|
-
* Returns whether the comment is deletable or not, respecting whether the
|
|
77
|
-
* workspace is read-only.
|
|
78
|
-
*/
|
|
79
|
-
isDeletable(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Returns whether the comment is deletable or not, only examining its own
|
|
82
|
-
* state and ignoring the state of the workspace.
|
|
83
|
-
*/
|
|
84
|
-
isOwnDeletable(): boolean;
|
|
85
|
-
/** Moves the comment to the given location in workspace coordinates. */
|
|
86
|
-
moveTo(location: Coordinate): void;
|
|
87
|
-
/** Returns the position of the comment in workspace coordinates. */
|
|
88
|
-
getRelativeToSurfaceXY(): Coordinate;
|
|
89
|
-
/** Disposes of this comment. */
|
|
90
|
-
dispose(): void;
|
|
91
|
-
/** Returns whether the comment has been disposed or not. */
|
|
92
|
-
isDisposed(): boolean;
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=workspace_comment.d.ts.map
|
package/core/comments.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2024 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { IIcon } from './i_icon.js';
|
|
7
|
-
import { Size } from '../utils/size.js';
|
|
8
|
-
import { IHasBubble } from './i_has_bubble.js';
|
|
9
|
-
export interface ICommentIcon extends IIcon, IHasBubble {
|
|
10
|
-
setText(text: string): void;
|
|
11
|
-
getText(): string;
|
|
12
|
-
setBubbleSize(size: Size): void;
|
|
13
|
-
getBubbleSize(): Size;
|
|
14
|
-
}
|
|
15
|
-
/** Checks whether the given object is an ICommentIcon. */
|
|
16
|
-
export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
|
|
17
|
-
//# sourceMappingURL=i_comment_icon.d.ts.map
|
package/core-node.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @file Blockly core module wrapper for node.js. This module loads
|
|
9
|
-
* blockly_compressed.js and jsdom, then calls
|
|
10
|
-
* Blockly.utils.xml.injectDependencies to supply needed XML-handling
|
|
11
|
-
* functions to Blocky.
|
|
12
|
-
*
|
|
13
|
-
* Note that, unlike index.js, this file does not get a UMD wrapper.
|
|
14
|
-
* This is because it is only used in node.js environments and so is
|
|
15
|
-
* guaranteed to be loaded as a CJS module.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/* eslint-disable */
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
const Blockly = require('./blockly_compressed.js');
|
|
22
|
-
const {JSDOM} = require('jsdom');
|
|
23
|
-
|
|
24
|
-
// Override textToDomDocument and provide node.js alternatives to
|
|
25
|
-
// DOMParser and XMLSerializer.
|
|
26
|
-
if (typeof globalThis.document !== 'object') {
|
|
27
|
-
const {window} = new JSDOM(`<!DOCTYPE html>`);
|
|
28
|
-
Blockly.utils.xml.injectDependencies(window);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = Blockly;
|
package/media/arrow-dropdown.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="#041E49"><path d="M480-360 280-560h400L480-360Z"/></svg>
|
package/media/resize-handle.svg
DELETED
package/msg/ce.d.ts
DELETED
package/msg/dtp.d.ts
DELETED
package/msg/hsb.d.ts
DELETED