blockly 11.0.0-beta.6 → 11.0.0-beta.7
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.min.js +352 -340
- package/blockly_compressed.js +341 -329
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -3
- package/core/block_svg.d.ts +23 -10
- package/core/blockly.d.ts +8 -13
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
- package/core/bubbles/text_bubble.d.ts +1 -1
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/comments/comment_view.d.ts +7 -1
- package/core/comments/rendered_workspace_comment.d.ts +36 -3
- package/core/comments/workspace_comment.d.ts +9 -3
- package/core/connection.d.ts +1 -1
- package/core/delete_area.d.ts +1 -2
- package/core/dragging/block_drag_strategy.d.ts +105 -0
- package/core/dragging/bubble_drag_strategy.d.ts +20 -0
- package/core/dragging/comment_drag_strategy.d.ts +20 -0
- package/core/dragging/dragger.d.ts +47 -0
- package/core/events/events.d.ts +3 -0
- package/core/events/events_comment_base.d.ts +6 -1
- package/core/events/events_comment_change.d.ts +1 -1
- package/core/events/events_comment_collapse.d.ts +39 -0
- package/core/events/events_comment_create.d.ts +5 -1
- package/core/events/events_comment_delete.d.ts +5 -1
- package/core/events/events_comment_move.d.ts +17 -1
- package/core/events/utils.d.ts +2 -0
- package/core/flyout_base.d.ts +17 -1
- package/core/flyout_button.d.ts +26 -1
- package/core/gesture.d.ts +23 -54
- package/core/icons/comment_icon.d.ts +5 -0
- package/core/interfaces/i_comment_icon.d.ts +5 -1
- package/core/interfaces/i_deletable.d.ts +6 -0
- package/core/interfaces/i_delete_area.d.ts +1 -2
- package/core/interfaces/i_draggable.d.ts +47 -3
- package/core/interfaces/i_dragger.d.ts +32 -0
- package/core/interfaces/i_selectable.d.ts +5 -3
- package/core/internal_constants.d.ts +0 -7
- package/core/keyboard_nav/ast_node.d.ts +21 -2
- package/core/registry.d.ts +2 -2
- package/core/renderers/common/marker_svg.d.ts +7 -0
- package/core/toolbox/toolbox.d.ts +1 -2
- package/core/workspace_comment_svg.d.ts +1 -2
- package/core/xml.d.ts +5 -0
- package/dart_compressed.js +8 -8
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +10 -10
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +6 -7
- package/lua_compressed.js.map +1 -1
- package/media/delete-icon.svg +1 -0
- package/package.json +2 -2
- package/php_compressed.js +7 -7
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +3 -3
- package/python_compressed.js.map +1 -1
- package/core/block_dragger.d.ts +0 -212
- package/core/bubble_dragger.d.ts +0 -77
- package/core/interfaces/i_block_dragger.d.ts +0 -47
- /package/media/{arrow-dropdown.svg → foldout-icon.svg} +0 -0
|
@@ -148,6 +148,13 @@ export declare class MarkerSvg {
|
|
|
148
148
|
* @param curNode The node to draw the marker for.
|
|
149
149
|
*/
|
|
150
150
|
protected showWithStack_(curNode: ASTNode): void;
|
|
151
|
+
/**
|
|
152
|
+
* Position and display the marker for a flyout button.
|
|
153
|
+
* This is a box with extra padding around the button.
|
|
154
|
+
*
|
|
155
|
+
* @param curNode The node to draw the marker for.
|
|
156
|
+
*/
|
|
157
|
+
protected showWithButton_(curNode: ASTNode): void;
|
|
151
158
|
/** Show the current marker. */
|
|
152
159
|
protected showCurrent_(): void;
|
|
153
160
|
/**************************
|
|
@@ -187,11 +187,10 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
187
187
|
* before onDragEnter/onDragOver/onDragExit.
|
|
188
188
|
*
|
|
189
189
|
* @param element The block or bubble currently being dragged.
|
|
190
|
-
* @param _couldConnect Whether the element could could connect to another.
|
|
191
190
|
* @returns Whether the element provided would be deleted if dropped on this
|
|
192
191
|
* area.
|
|
193
192
|
*/
|
|
194
|
-
wouldDelete(element: IDraggable
|
|
193
|
+
wouldDelete(element: IDraggable): boolean;
|
|
195
194
|
/**
|
|
196
195
|
* Handles when a cursor with a block or bubble enters this drag target.
|
|
197
196
|
*
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import './events/events_selected.js';
|
|
12
12
|
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
13
|
-
import type { IBubble } from './interfaces/i_bubble.js';
|
|
14
13
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
15
14
|
import { Coordinate } from './utils/coordinate.js';
|
|
16
15
|
import { Rect } from './utils/rect.js';
|
|
@@ -20,7 +19,7 @@ import { WorkspaceCommentCopyData } from './clipboard/workspace_comment_paster.j
|
|
|
20
19
|
/**
|
|
21
20
|
* Class for a workspace comment's SVG representation.
|
|
22
21
|
*/
|
|
23
|
-
export declare class WorkspaceCommentSvg extends WorkspaceComment implements IBoundedElement,
|
|
22
|
+
export declare class WorkspaceCommentSvg extends WorkspaceComment implements IBoundedElement, ICopyable<WorkspaceCommentCopyData> {
|
|
24
23
|
/**
|
|
25
24
|
* The width and height to use to size a workspace comment when it is first
|
|
26
25
|
* added, before it has been edited by the user.
|
package/core/xml.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { Block } from './block.js';
|
|
|
7
7
|
import type { VariableModel } from './variable_model.js';
|
|
8
8
|
import type { Workspace } from './workspace.js';
|
|
9
9
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
10
|
+
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
10
11
|
/**
|
|
11
12
|
* Encode a block tree as XML.
|
|
12
13
|
*
|
|
@@ -16,6 +17,8 @@ import { WorkspaceSvg } from './workspace_svg.js';
|
|
|
16
17
|
* @returns XML DOM element.
|
|
17
18
|
*/
|
|
18
19
|
export declare function workspaceToDom(workspace: Workspace, skipId?: boolean): Element;
|
|
20
|
+
/** Serializes the given workspace comment to XML. */
|
|
21
|
+
export declare function saveWorkspaceComment(comment: WorkspaceComment, skipId?: boolean): Element;
|
|
19
22
|
/**
|
|
20
23
|
* Encode a list of variables as XML.
|
|
21
24
|
*
|
|
@@ -74,6 +77,8 @@ export declare function clearWorkspaceAndLoadFromXml(xml: Element, workspace: Wo
|
|
|
74
77
|
* @returns An array containing new block IDs.
|
|
75
78
|
*/
|
|
76
79
|
export declare function domToWorkspace(xml: Element, workspace: Workspace): string[];
|
|
80
|
+
/** Deserializes the given comment state into the given workspace. */
|
|
81
|
+
export declare function loadWorkspaceComment(elem: Element, workspace: Workspace): WorkspaceComment;
|
|
77
82
|
/**
|
|
78
83
|
* Decode an XML DOM and create blocks on the workspace. Position the new
|
|
79
84
|
* blocks immediately below prior blocks, aligned by their starting edge.
|
package/dart_compressed.js
CHANGED
|
@@ -226,19 +226,19 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
|
|
|
226
226
|
}
|
|
227
227
|
`)+"("+c+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},math_random_float$$module$build$src$generators$dart$math=function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";return["new Math.Random().nextDouble()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},math_atan2$$module$build$src$generators$dart$math=function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";const c=b.valueToCode(a,"X",Order$$module$build$src$generators$dart$dart_generator.NONE)||
|
|
228
228
|
"0";return["Math.atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0")+", "+c+") / Math.pi * 180",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE]},procedures_defreturn$$module$build$src$generators$dart$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME"));var d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));
|
|
229
|
-
let e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));
|
|
230
|
-
function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},procedures_callnoreturn$$module$build$src$generators$dart$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,
|
|
231
|
-
function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$dart$dart_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$dart$text=
|
|
232
|
-
Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},text_join$$module$build$src$generators$dart$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".toString()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];default:const c=Array(a.itemCount_);
|
|
233
|
-
b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return["["+c.join(",")+"].join()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}},text_append$$module$build$src$generators$dart$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_length$$module$build$src$generators$dart$text=
|
|
234
|
-
b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_isEmpty$$module$build$src$generators$dart$text=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_indexOf$$module$build$src$generators$dart$text=
|
|
229
|
+
let e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let f="";a.getInput("STACK")&&(f=b.statementToCode(a,"STACK"));let g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$dart$dart_generator.NONE)||"");let h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");const k=g?"dynamic":"void",l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d=k+" "+c+"("+l.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,
|
|
230
|
+
d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$dart$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},procedures_callnoreturn$$module$build$src$generators$dart$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,
|
|
231
|
+
b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$dart$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$dart$dart_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$dart$text=
|
|
232
|
+
function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},text_join$$module$build$src$generators$dart$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".toString()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];default:const c=Array(a.itemCount_);
|
|
233
|
+
for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return["["+c.join(",")+"].join()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}},text_append$$module$build$src$generators$dart$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_length$$module$build$src$generators$dart$text=
|
|
234
|
+
function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_isEmpty$$module$build$src$generators$dart$text=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_indexOf$$module$build$src$generators$dart$text=
|
|
235
235
|
function(a,b){const c="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE]:[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_charAt$$module$build$src$generators$dart$text=
|
|
236
236
|
function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE","FIRST"===c||"FROM_START"===c?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";switch(c){case "FIRST":return[d+"[0]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "FROM_START":return a=b.getAdjusted(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "LAST":case "FROM_END":return a=
|
|
237
|
-
b.getAdjusted(a,"AT",1),[b.provideFunction_("text_get_from_end",`
|
|
237
|
+
"LAST"===c?1:b.getAdjusted(a,"AT",1),[`${b.provideFunction_("text_get_from_end",`
|
|
238
238
|
String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {
|
|
239
239
|
return text[text.length - x];
|
|
240
240
|
}
|
|
241
|
-
`)
|
|
241
|
+
`)}(${d}, ${a})`,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "RANDOM":return b.definitions_.import_dart_math="import 'dart:math' as Math;",[b.provideFunction_("text_random_letter",`
|
|
242
242
|
String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text) {
|
|
243
243
|
int x = new Math.Random().nextInt(text.length);
|
|
244
244
|
return text[x];
|