blockly 12.0.0-beta.1 → 12.0.0-beta.2

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.
Files changed (39) hide show
  1. package/blockly.min.js +178 -178
  2. package/blockly_compressed.js +163 -163
  3. package/blockly_compressed.js.map +1 -1
  4. package/core/block_flyout_inflater.d.ts +5 -6
  5. package/core/blockly.d.ts +3 -1
  6. package/core/bubbles/text_bubble.d.ts +5 -5
  7. package/core/button_flyout_inflater.d.ts +3 -3
  8. package/core/comments/comment_view.d.ts +3 -3
  9. package/core/contextmenu_registry.d.ts +51 -11
  10. package/core/dragging/block_drag_strategy.d.ts +2 -2
  11. package/core/dragging/bubble_drag_strategy.d.ts +0 -2
  12. package/core/dragging/comment_drag_strategy.d.ts +0 -2
  13. package/core/field.d.ts +0 -2
  14. package/core/field_dropdown.d.ts +7 -9
  15. package/core/interfaces/i_flyout_inflater.d.ts +3 -3
  16. package/core/interfaces/i_focusable_node.d.ts +34 -0
  17. package/core/interfaces/i_focusable_tree.d.ts +48 -0
  18. package/core/keyboard_nav/marker.d.ts +4 -8
  19. package/core/label_flyout_inflater.d.ts +3 -3
  20. package/core/menu.d.ts +29 -23
  21. package/core/menu_separator.d.ts +25 -0
  22. package/core/menuitem.d.ts +7 -0
  23. package/core/renderers/common/marker_svg.d.ts +2 -2
  24. package/core/separator_flyout_inflater.d.ts +3 -3
  25. package/core/utils/aria.d.ts +2 -1
  26. package/core/utils/toolbox.d.ts +0 -2
  27. package/core/workspace.d.ts +13 -0
  28. package/core/workspace_svg.d.ts +1 -0
  29. package/dart_compressed.js +1 -1
  30. package/dart_compressed.js.map +1 -1
  31. package/javascript_compressed.js +15 -15
  32. package/javascript_compressed.js.map +1 -1
  33. package/lua_compressed.js +1 -1
  34. package/lua_compressed.js.map +1 -1
  35. package/package.json +2 -2
  36. package/php_compressed.js +1 -1
  37. package/php_compressed.js.map +1 -1
  38. package/python_compressed.js +3 -3
  39. package/python_compressed.js.map +1 -1
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { FlyoutItem } from './flyout_item.js';
7
+ import type { IFlyout } from './interfaces/i_flyout.js';
7
8
  import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
8
- import type { WorkspaceSvg } from './workspace_svg.js';
9
9
  /**
10
10
  * @internal
11
11
  */
@@ -29,10 +29,10 @@ export declare class SeparatorFlyoutInflater implements IFlyoutInflater {
29
29
  * returned by gapForElement, which knows the default gap, unlike this method.
30
30
  *
31
31
  * @param _state A JSON representation of a flyout separator.
32
- * @param flyoutWorkspace The workspace the separator belongs to.
32
+ * @param flyout The flyout to create the separator for.
33
33
  * @returns A newly created FlyoutSeparator.
34
34
  */
35
- load(_state: object, flyoutWorkspace: WorkspaceSvg): FlyoutItem;
35
+ load(_state: object, flyout: IFlyout): FlyoutItem;
36
36
  /**
37
37
  * Returns the size of the separator. See `load` for more details.
38
38
  *
@@ -19,7 +19,8 @@ export declare enum Role {
19
19
  PRESENTATION = "presentation",
20
20
  ROW = "row",
21
21
  TREE = "tree",
22
- TREEITEM = "treeitem"
22
+ TREEITEM = "treeitem",
23
+ SEPARATOR = "separator"
23
24
  }
24
25
  /**
25
26
  * ARIA states and properties.
@@ -19,8 +19,6 @@ export interface BlockInfo {
19
19
  disabledReasons?: string[];
20
20
  enabled?: boolean;
21
21
  id?: string;
22
- x?: number;
23
- y?: number;
24
22
  collapsed?: boolean;
25
23
  inline?: boolean;
26
24
  data?: string;
@@ -82,6 +82,7 @@ export declare class Workspace implements IASTNodeLocation {
82
82
  private readonly typedBlocksDB;
83
83
  private variableMap;
84
84
  private procedureMap;
85
+ private readOnly;
85
86
  /**
86
87
  * Blocks in the flyout can refer to variables that don't exist in the main
87
88
  * workspace. For instance, the "get item in list" block refers to an
@@ -456,5 +457,17 @@ export declare class Workspace implements IASTNodeLocation {
456
457
  */
457
458
  static getAll(): Workspace[];
458
459
  protected getVariableMapClass(): new (...p1: any[]) => IVariableMap<IVariableModel<IVariableState>>;
460
+ /**
461
+ * Returns whether or not this workspace is in readonly mode.
462
+ *
463
+ * @returns True if the workspace is readonly, otherwise false.
464
+ */
465
+ isReadOnly(): boolean;
466
+ /**
467
+ * Sets whether or not this workspace is in readonly mode.
468
+ *
469
+ * @param readOnly True to make the workspace readonly, otherwise false.
470
+ */
471
+ setIsReadOnly(readOnly: boolean): void;
459
472
  }
460
473
  //# sourceMappingURL=workspace.d.ts.map
@@ -1003,6 +1003,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
1003
1003
  * @param className Name of class to remove.
1004
1004
  */
1005
1005
  removeClass(className: string): void;
1006
+ setIsReadOnly(readOnly: boolean): void;
1006
1007
  }
1007
1008
  /**
1008
1009
  * Size the workspace when the contents change. This also updates
@@ -79,7 +79,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
79
79
  }
80
80
  `)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_split$$module$build$src$generators$dart$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)c||(c="''"),a="split";else if("JOIN"===a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+
81
81
  "."+a+"("+b+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_reverse$$module$build$src$generators$dart$lists=function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]")+".reversed)",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},controls_if$$module$build$src$generators$dart$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=
82
- b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=b.statementToCode(a,"ELSE"),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
82
+ b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
83
83
  function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===c||"!="===c?Order$$module$build$src$generators$dart$dart_generator.EQUALITY:Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$dart$logic=function(a,b){const c="AND"===a.getFieldValue("OP")?"&&":"||",d="&&"===c?Order$$module$build$src$generators$dart$dart_generator.LOGICAL_AND:
84
84
  Order$$module$build$src$generators$dart$dart_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="&&"===c?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$dart$logic=function(a,b){const c=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$dart$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?
85
85
  "true":"false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_null$$module$build$src$generators$dart$logic=function(a,b){return["null",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_ternary$$module$build$src$generators$dart$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";a=b.valueToCode(a,