blockly 11.1.1 → 11.2.0-beta.1

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 (164) hide show
  1. package/blockly.min.js +551 -525
  2. package/blockly.mjs +1 -0
  3. package/blockly_compressed.js +519 -493
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +32 -32
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +20 -14
  8. package/core/block_svg.d.ts +42 -9
  9. package/core/blockly.d.ts +11 -147
  10. package/core/blockly_options.d.ts +2 -2
  11. package/core/browser_events.d.ts +2 -2
  12. package/core/bubbles/bubble.d.ts +2 -2
  13. package/core/bubbles/mini_workspace_bubble.d.ts +3 -3
  14. package/core/bubbles/text_bubble.d.ts +1 -1
  15. package/core/bubbles/textinput_bubble.d.ts +6 -1
  16. package/core/bubbles.d.ts +2 -2
  17. package/core/clipboard/workspace_comment_paster.d.ts +3 -3
  18. package/core/clipboard.d.ts +2 -2
  19. package/core/comments/comment_view.d.ts +10 -3
  20. package/core/comments/rendered_workspace_comment.d.ts +10 -10
  21. package/core/comments/workspace_comment.d.ts +2 -2
  22. package/core/comments.d.ts +1 -1
  23. package/core/component_manager.d.ts +8 -0
  24. package/core/connection.d.ts +3 -3
  25. package/core/dragging/block_drag_strategy.d.ts +3 -1
  26. package/core/dragging/bubble_drag_strategy.d.ts +3 -1
  27. package/core/dragging/comment_drag_strategy.d.ts +8 -1
  28. package/core/dragging/dragger.d.ts +2 -2
  29. package/core/dragging.d.ts +2 -2
  30. package/core/dropdowndiv.d.ts +3 -3
  31. package/core/events/events.d.ts +67 -127
  32. package/core/events/events_abstract.d.ts +0 -1
  33. package/core/events/events_block_change.d.ts +2 -1
  34. package/core/events/events_block_create.d.ts +3 -2
  35. package/core/events/events_block_delete.d.ts +3 -2
  36. package/core/events/events_block_drag.d.ts +3 -2
  37. package/core/events/events_block_field_intermediate_change.d.ts +2 -1
  38. package/core/events/events_block_move.d.ts +3 -2
  39. package/core/events/events_bubble_open.d.ts +4 -3
  40. package/core/events/events_click.d.ts +3 -2
  41. package/core/events/events_comment_base.d.ts +1 -1
  42. package/core/events/events_comment_change.d.ts +8 -2
  43. package/core/events/events_comment_collapse.d.ts +3 -2
  44. package/core/events/events_comment_create.d.ts +8 -2
  45. package/core/events/events_comment_delete.d.ts +8 -2
  46. package/core/events/events_comment_drag.d.ts +51 -0
  47. package/core/events/events_comment_move.d.ts +9 -3
  48. package/core/events/events_comment_resize.d.ts +68 -0
  49. package/core/events/events_marker_move.d.ts +2 -1
  50. package/core/events/events_selected.d.ts +3 -2
  51. package/core/events/events_theme_change.d.ts +3 -2
  52. package/core/events/events_toolbox_item_select.d.ts +3 -2
  53. package/core/events/events_trashcan_open.d.ts +3 -2
  54. package/core/events/events_var_base.d.ts +1 -1
  55. package/core/events/events_var_create.d.ts +3 -2
  56. package/core/events/events_var_delete.d.ts +3 -2
  57. package/core/events/events_var_rename.d.ts +3 -2
  58. package/core/events/events_viewport.d.ts +3 -2
  59. package/core/events/predicates.d.ts +90 -0
  60. package/core/events/type.d.ts +79 -0
  61. package/core/events/utils.d.ts +93 -125
  62. package/core/events/workspace_events.d.ts +2 -1
  63. package/core/extensions.d.ts +1 -1
  64. package/core/field.d.ts +1 -1
  65. package/core/field_dropdown.d.ts +34 -0
  66. package/core/field_input.d.ts +1 -1
  67. package/core/field_label.d.ts +6 -0
  68. package/core/flyout_base.d.ts +1 -1
  69. package/core/flyout_button.d.ts +6 -1
  70. package/core/generator.d.ts +3 -2
  71. package/core/gesture.d.ts +3 -3
  72. package/core/grid.d.ts +7 -1
  73. package/core/icons/comment_icon.d.ts +5 -6
  74. package/core/icons/icon.d.ts +1 -1
  75. package/core/icons/mutator_icon.d.ts +3 -3
  76. package/core/icons/warning_icon.d.ts +2 -2
  77. package/core/icons.d.ts +5 -5
  78. package/core/inputs/input.d.ts +1 -1
  79. package/core/inputs.d.ts +3 -3
  80. package/core/interfaces/i_ast_node_location_with_block.d.ts +1 -1
  81. package/core/interfaces/i_comment_icon.d.ts +2 -2
  82. package/core/interfaces/i_drag_target.d.ts +1 -1
  83. package/core/interfaces/i_flyout.d.ts +3 -3
  84. package/core/interfaces/i_legacy_procedure_blocks.d.ts +2 -2
  85. package/core/interfaces/i_metrics_manager.d.ts +2 -2
  86. package/core/interfaces/i_positionable.d.ts +1 -1
  87. package/core/interfaces/i_selectable.d.ts +1 -1
  88. package/core/interfaces/i_serializer.d.ts +2 -2
  89. package/core/interfaces/i_toolbox.d.ts +3 -3
  90. package/core/keyboard_nav/ast_node.d.ts +1 -1
  91. package/core/layer_manager.d.ts +1 -1
  92. package/core/layers.d.ts +0 -2
  93. package/core/procedures.d.ts +3 -3
  94. package/core/registry.d.ts +6 -6
  95. package/core/rendered_connection.d.ts +10 -5
  96. package/core/renderers/common/block_rendering.d.ts +3 -30
  97. package/core/renderers/common/i_path_object.d.ts +2 -2
  98. package/core/renderers/common/info.d.ts +1 -1
  99. package/core/renderers/common/marker_svg.d.ts +5 -5
  100. package/core/renderers/zelos/constants.d.ts +1 -1
  101. package/core/serialization/procedures.d.ts +2 -2
  102. package/core/serialization/workspace_comments.d.ts +1 -1
  103. package/core/serialization.d.ts +3 -3
  104. package/core/shortcut_registry.d.ts +70 -10
  105. package/core/toolbox/toolbox.d.ts +1 -6
  106. package/core/tooltip.d.ts +1 -1
  107. package/core/trashcan.d.ts +1 -6
  108. package/core/utils/drag.d.ts +33 -0
  109. package/core/utils/rect.d.ts +26 -0
  110. package/core/utils/size.d.ts +1 -1
  111. package/core/variables_dynamic.d.ts +1 -1
  112. package/core/workspace.d.ts +4 -5
  113. package/core/workspace_svg.d.ts +4 -6
  114. package/core/xml.d.ts +1 -1
  115. package/dart_compressed.js.map +1 -1
  116. package/generators/dart/dart_generator.d.ts +4 -0
  117. package/generators/dart/lists.d.ts +0 -3
  118. package/generators/dart/procedures.d.ts +0 -3
  119. package/generators/dart/text.d.ts +0 -3
  120. package/generators/javascript/javascript_generator.d.ts +4 -0
  121. package/generators/javascript/lists.d.ts +0 -3
  122. package/generators/javascript/procedures.d.ts +0 -3
  123. package/generators/javascript/text.d.ts +0 -3
  124. package/generators/lua/lists.d.ts +0 -3
  125. package/generators/lua/lua_generator.d.ts +6 -0
  126. package/generators/lua/procedures.d.ts +0 -3
  127. package/generators/lua/text.d.ts +0 -3
  128. package/generators/lua.d.ts +0 -4
  129. package/generators/php/lists.d.ts +1 -1
  130. package/generators/php/logic.d.ts +1 -1
  131. package/generators/php/math.d.ts +1 -1
  132. package/generators/php/php_generator.d.ts +4 -0
  133. package/generators/php/procedures.d.ts +1 -1
  134. package/generators/php/text.d.ts +1 -4
  135. package/generators/php/variables.d.ts +1 -1
  136. package/generators/php.d.ts +0 -5
  137. package/generators/python/lists.d.ts +1 -1
  138. package/generators/python/procedures.d.ts +1 -1
  139. package/generators/python/python_generator.d.ts +4 -0
  140. package/generators/python/text.d.ts +1 -1
  141. package/generators/python.d.ts +0 -5
  142. package/index.mjs +1 -0
  143. package/javascript_compressed.js.map +1 -1
  144. package/lua_compressed.js.map +1 -1
  145. package/media/1x1.gif +0 -0
  146. package/media/click.mp3 +0 -0
  147. package/media/click.ogg +0 -0
  148. package/media/click.wav +0 -0
  149. package/media/delete.mp3 +0 -0
  150. package/media/delete.ogg +0 -0
  151. package/media/delete.wav +0 -0
  152. package/media/disconnect.mp3 +0 -0
  153. package/media/disconnect.ogg +0 -0
  154. package/media/disconnect.wav +0 -0
  155. package/media/handclosed.cur +0 -0
  156. package/media/handdelete.cur +0 -0
  157. package/media/handopen.cur +0 -0
  158. package/media/pilcrow.png +0 -0
  159. package/media/quote0.png +0 -0
  160. package/media/quote1.png +0 -0
  161. package/media/sprites.png +0 -0
  162. package/package.json +16 -13
  163. package/php_compressed.js.map +1 -1
  164. package/python_compressed.js.map +1 -1
@@ -3,15 +3,21 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Class for comment deletion event.
8
+ *
9
+ * @class
10
+ */
6
11
  import type { WorkspaceComment } from '../comments/workspace_comment.js';
7
12
  import * as comments from '../serialization/workspace_comments.js';
8
- import { CommentBase, CommentBaseJson } from './events_comment_base.js';
9
13
  import type { Workspace } from '../workspace.js';
14
+ import { CommentBase, CommentBaseJson } from './events_comment_base.js';
15
+ import { EventType } from './type.js';
10
16
  /**
11
17
  * Notifies listeners that a workspace comment has been deleted.
12
18
  */
13
19
  export declare class CommentDelete extends CommentBase {
14
- type: string;
20
+ type: EventType;
15
21
  /** The XML representation of the deleted workspace comment. */
16
22
  xml?: Element;
17
23
  /** The JSON representation of the created workspace comment. */
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Events fired when a workspace comment is dragged.
8
+ */
9
+ import type { WorkspaceComment } from '../comments/workspace_comment.js';
10
+ import { Workspace } from '../workspace.js';
11
+ import { AbstractEventJson } from './events_abstract.js';
12
+ import { UiBase } from './events_ui_base.js';
13
+ import { EventType } from './type.js';
14
+ /**
15
+ * Notifies listeners when a comment is being manually dragged/dropped.
16
+ */
17
+ export declare class CommentDrag extends UiBase {
18
+ /** The ID of the top-level comment being dragged. */
19
+ commentId?: string;
20
+ /** True if this is the start of a drag, false if this is the end of one. */
21
+ isStart?: boolean;
22
+ type: EventType;
23
+ /**
24
+ * @param opt_comment The comment that is being dragged.
25
+ * Undefined for a blank event.
26
+ * @param opt_isStart Whether this is the start of a comment drag.
27
+ * Undefined for a blank event.
28
+ */
29
+ constructor(opt_comment?: WorkspaceComment, opt_isStart?: boolean);
30
+ /**
31
+ * Encode the event as JSON.
32
+ *
33
+ * @returns JSON representation.
34
+ */
35
+ toJson(): CommentDragJson;
36
+ /**
37
+ * Deserializes the JSON event.
38
+ *
39
+ * @param event The event to append new properties to. Should be a subclass
40
+ * of CommentDrag, but we can't specify that due to the fact that parameters
41
+ * to static methods in subclasses must be supertypes of parameters to
42
+ * static methods in superclasses.
43
+ * @internal
44
+ */
45
+ static fromJson(json: CommentDragJson, workspace: Workspace, event?: any): CommentDrag;
46
+ }
47
+ export interface CommentDragJson extends AbstractEventJson {
48
+ isStart: boolean;
49
+ commentId: string;
50
+ }
51
+ //# sourceMappingURL=events_comment_drag.d.ts.map
@@ -3,15 +3,21 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Coordinate } from '../utils/coordinate.js';
6
+ /**
7
+ * Class for comment move event.
8
+ *
9
+ * @class
10
+ */
7
11
  import type { WorkspaceComment } from '../comments/workspace_comment.js';
8
- import { CommentBase, CommentBaseJson } from './events_comment_base.js';
12
+ import { Coordinate } from '../utils/coordinate.js';
9
13
  import type { Workspace } from '../workspace.js';
14
+ import { CommentBase, CommentBaseJson } from './events_comment_base.js';
15
+ import { EventType } from './type.js';
10
16
  /**
11
17
  * Notifies listeners that a workspace comment has moved.
12
18
  */
13
19
  export declare class CommentMove extends CommentBase {
14
- type: string;
20
+ type: EventType;
15
21
  /** The comment that is being moved. */
16
22
  comment_?: WorkspaceComment;
17
23
  /** The location of the comment before the move, in workspace coordinates. */
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Class for comment resize event.
8
+ */
9
+ import type { WorkspaceComment } from '../comments/workspace_comment.js';
10
+ import { Size } from '../utils/size.js';
11
+ import type { Workspace } from '../workspace.js';
12
+ import { CommentBase, CommentBaseJson } from './events_comment_base.js';
13
+ import { EventType } from './type.js';
14
+ /**
15
+ * Notifies listeners that a workspace comment has resized.
16
+ */
17
+ export declare class CommentResize extends CommentBase {
18
+ type: EventType;
19
+ /** The size of the comment before the resize. */
20
+ oldSize?: Size;
21
+ /** The size of the comment after the resize. */
22
+ newSize?: Size;
23
+ /**
24
+ * @param opt_comment The comment that is being resized. Undefined for a blank
25
+ * event.
26
+ */
27
+ constructor(opt_comment?: WorkspaceComment);
28
+ /**
29
+ * Record the comment's new size. Called after the resize. Can only be
30
+ * called once.
31
+ */
32
+ recordCurrentSizeAsNewSize(): void;
33
+ /**
34
+ * Encode the event as JSON.
35
+ *
36
+ * @returns JSON representation.
37
+ */
38
+ toJson(): CommentResizeJson;
39
+ /**
40
+ * Deserializes the JSON event.
41
+ *
42
+ * @param event The event to append new properties to. Should be a subclass
43
+ * of CommentResize, but we can't specify that due to the fact that
44
+ * parameters to static methods in subclasses must be supertypes of
45
+ * parameters to static methods in superclasses.
46
+ * @internal
47
+ */
48
+ static fromJson(json: CommentResizeJson, workspace: Workspace, event?: any): CommentResize;
49
+ /**
50
+ * Does this event record any change of state?
51
+ *
52
+ * @returns False if something changed.
53
+ */
54
+ isNull(): boolean;
55
+ /**
56
+ * Run a resize event.
57
+ *
58
+ * @param forward True if run forward, false if run backward (undo).
59
+ */
60
+ run(forward: boolean): void;
61
+ }
62
+ export interface CommentResizeJson extends CommentBaseJson {
63
+ oldWidth: number;
64
+ oldHeight: number;
65
+ newWidth: number;
66
+ newHeight: number;
67
+ }
68
+ //# sourceMappingURL=events_comment_resize.d.ts.map
@@ -13,6 +13,7 @@ import { ASTNode } from '../keyboard_nav/ast_node.js';
13
13
  import type { Workspace } from '../workspace.js';
14
14
  import { AbstractEventJson } from './events_abstract.js';
15
15
  import { UiBase } from './events_ui_base.js';
16
+ import { EventType } from './type.js';
16
17
  /**
17
18
  * Notifies listeners that a marker (used for keyboard navigation) has
18
19
  * moved.
@@ -30,7 +31,7 @@ export declare class MarkerMove extends UiBase {
30
31
  * https://blocklycodelabs.dev/codelabs/keyboard-navigation/index.html?index=..%2F..index#1}.
31
32
  */
32
33
  isCursor?: boolean;
33
- type: string;
34
+ type: EventType;
34
35
  /**
35
36
  * @param opt_block The affected block. Null if current node is of type
36
37
  * workspace. Undefined for a blank event.
@@ -3,9 +3,10 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { Workspace } from '../workspace.js';
6
7
  import { AbstractEventJson } from './events_abstract.js';
7
8
  import { UiBase } from './events_ui_base.js';
8
- import type { Workspace } from '../workspace.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Class for a selected event.
11
12
  * Notifies listeners that a new element has been selected.
@@ -18,7 +19,7 @@ export declare class Selected extends UiBase {
18
19
  * or undefined if unselected.
19
20
  */
20
21
  newElementId?: string;
21
- type: string;
22
+ type: EventType;
22
23
  /**
23
24
  * @param opt_oldElementId The ID of the previously selected element. Null if
24
25
  * no element last selected. Undefined for a blank event.
@@ -3,16 +3,17 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { Workspace } from '../workspace.js';
6
7
  import { AbstractEventJson } from './events_abstract.js';
7
8
  import { UiBase } from './events_ui_base.js';
8
- import type { Workspace } from '../workspace.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that the workspace theme has changed.
11
12
  */
12
13
  export declare class ThemeChange extends UiBase {
13
14
  /** The name of the new theme that has been set. */
14
15
  themeName?: string;
15
- type: string;
16
+ type: EventType;
16
17
  /**
17
18
  * @param opt_themeName The theme name. Undefined for a blank event.
18
19
  * @param opt_workspaceId The workspace identifier for this event.
@@ -3,9 +3,10 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { Workspace } from '../workspace.js';
6
7
  import { AbstractEventJson } from './events_abstract.js';
7
8
  import { UiBase } from './events_ui_base.js';
8
- import type { Workspace } from '../workspace.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that a toolbox item has been selected.
11
12
  */
@@ -14,7 +15,7 @@ export declare class ToolboxItemSelect extends UiBase {
14
15
  oldItem?: string;
15
16
  /** The newly selected toolbox item. */
16
17
  newItem?: string;
17
- type: string;
18
+ type: EventType;
18
19
  /**
19
20
  * @param opt_oldItem The previously selected toolbox item.
20
21
  * Undefined for a blank event.
@@ -3,9 +3,10 @@
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { Workspace } from '../workspace.js';
6
7
  import { AbstractEventJson } from './events_abstract.js';
7
8
  import { UiBase } from './events_ui_base.js';
8
- import type { Workspace } from '../workspace.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners when the trashcan is opening or closing.
11
12
  */
@@ -15,7 +16,7 @@ export declare class TrashcanOpen extends UiBase {
15
16
  * False if it is currently closing (previously open).
16
17
  */
17
18
  isOpen?: boolean;
18
- type: string;
19
+ type: EventType;
19
20
  /**
20
21
  * @param opt_isOpen Whether the trashcan flyout is opening (false if
21
22
  * opening). Undefined for a blank event.
@@ -9,8 +9,8 @@
9
9
  * @class
10
10
  */
11
11
  import type { VariableModel } from '../variable_model.js';
12
- import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
13
12
  import type { Workspace } from '../workspace.js';
13
+ import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
14
14
  /**
15
15
  * Abstract class for a variable event.
16
16
  */
@@ -4,13 +4,14 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { VariableModel } from '../variable_model.js';
7
- import { VarBase, VarBaseJson } from './events_var_base.js';
8
7
  import type { Workspace } from '../workspace.js';
8
+ import { VarBase, VarBaseJson } from './events_var_base.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that a variable model has been created.
11
12
  */
12
13
  export declare class VarCreate extends VarBase {
13
- type: string;
14
+ type: EventType;
14
15
  /** The type of the variable that was created. */
15
16
  varType?: string;
16
17
  /** The name of the variable that was created. */
@@ -4,15 +4,16 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { VariableModel } from '../variable_model.js';
7
- import { VarBase, VarBaseJson } from './events_var_base.js';
8
7
  import type { Workspace } from '../workspace.js';
8
+ import { VarBase, VarBaseJson } from './events_var_base.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that a variable model has been deleted.
11
12
  *
12
13
  * @class
13
14
  */
14
15
  export declare class VarDelete extends VarBase {
15
- type: string;
16
+ type: EventType;
16
17
  /** The type of the variable that was deleted. */
17
18
  varType?: string;
18
19
  /** The name of the variable that was deleted. */
@@ -4,15 +4,16 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { VariableModel } from '../variable_model.js';
7
- import { VarBase, VarBaseJson } from './events_var_base.js';
8
7
  import type { Workspace } from '../workspace.js';
8
+ import { VarBase, VarBaseJson } from './events_var_base.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that a variable model was renamed.
11
12
  *
12
13
  * @class
13
14
  */
14
15
  export declare class VarRename extends VarBase {
15
- type: string;
16
+ type: EventType;
16
17
  /** The previous name of the variable. */
17
18
  oldName?: string;
18
19
  /** The new name of the variable. */
@@ -3,9 +3,10 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import type { Workspace } from '../workspace.js';
6
7
  import { AbstractEventJson } from './events_abstract.js';
7
8
  import { UiBase } from './events_ui_base.js';
8
- import type { Workspace } from '../workspace.js';
9
+ import { EventType } from './type.js';
9
10
  /**
10
11
  * Notifies listeners that the workspace surface's position or scale has
11
12
  * changed.
@@ -27,7 +28,7 @@ export declare class ViewportChange extends UiBase {
27
28
  scale?: number;
28
29
  /** The previous scale of the workspace. */
29
30
  oldScale?: number;
30
- type: string;
31
+ type: EventType;
31
32
  /**
32
33
  * @param opt_top Top-edge of the visible portion of the workspace, relative
33
34
  * to the workspace origin. Undefined for a blank event.
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * @file Predicates for testing Abstract event subclasses based on
8
+ * their .type properties. These are useful because there are places
9
+ * where it is not possible to use instanceof <ClassConstructor> tests
10
+ * for type narrowing due to load ordering issues that would be caused
11
+ * by the need to import (rather than just import type) the class
12
+ * constructors in question.
13
+ */
14
+ import type { Abstract } from './events_abstract.js';
15
+ import type { BlockChange } from './events_block_change.js';
16
+ import type { BlockCreate } from './events_block_create.js';
17
+ import type { BlockDelete } from './events_block_delete.js';
18
+ import type { BlockDrag } from './events_block_drag.js';
19
+ import type { BlockFieldIntermediateChange } from './events_block_field_intermediate_change.js';
20
+ import type { BlockMove } from './events_block_move.js';
21
+ import type { BubbleOpen } from './events_bubble_open.js';
22
+ import type { Click } from './events_click.js';
23
+ import type { CommentChange } from './events_comment_change.js';
24
+ import type { CommentCollapse } from './events_comment_collapse.js';
25
+ import type { CommentCreate } from './events_comment_create.js';
26
+ import type { CommentDelete } from './events_comment_delete.js';
27
+ import type { CommentDrag } from './events_comment_drag.js';
28
+ import type { CommentMove } from './events_comment_move.js';
29
+ import type { CommentResize } from './events_comment_resize.js';
30
+ import type { MarkerMove } from './events_marker_move.js';
31
+ import type { Selected } from './events_selected.js';
32
+ import type { ThemeChange } from './events_theme_change.js';
33
+ import type { ToolboxItemSelect } from './events_toolbox_item_select.js';
34
+ import type { TrashcanOpen } from './events_trashcan_open.js';
35
+ import type { VarCreate } from './events_var_create.js';
36
+ import type { VarDelete } from './events_var_delete.js';
37
+ import type { VarRename } from './events_var_rename.js';
38
+ import type { ViewportChange } from './events_viewport.js';
39
+ import type { FinishedLoading } from './workspace_events.js';
40
+ /** @returns true iff event.type is EventType.BLOCK_CREATE */
41
+ export declare function isBlockCreate(event: Abstract): event is BlockCreate;
42
+ /** @returns true iff event.type is EventType.BLOCK_DELETE */
43
+ export declare function isBlockDelete(event: Abstract): event is BlockDelete;
44
+ /** @returns true iff event.type is EventType.BLOCK_CHANGE */
45
+ export declare function isBlockChange(event: Abstract): event is BlockChange;
46
+ /** @returns true iff event.type is EventType.BLOCK_FIELD_INTERMEDIATE_CHANGE */
47
+ export declare function isBlockFieldIntermediateChange(event: Abstract): event is BlockFieldIntermediateChange;
48
+ /** @returns true iff event.type is EventType.BLOCK_MOVE */
49
+ export declare function isBlockMove(event: Abstract): event is BlockMove;
50
+ /** @returns true iff event.type is EventType.VAR_CREATE */
51
+ export declare function isVarCreate(event: Abstract): event is VarCreate;
52
+ /** @returns true iff event.type is EventType.VAR_DELETE */
53
+ export declare function isVarDelete(event: Abstract): event is VarDelete;
54
+ /** @returns true iff event.type is EventType.VAR_RENAME */
55
+ export declare function isVarRename(event: Abstract): event is VarRename;
56
+ /** @returns true iff event.type is EventType.BLOCK_DRAG */
57
+ export declare function isBlockDrag(event: Abstract): event is BlockDrag;
58
+ /** @returns true iff event.type is EventType.SELECTED */
59
+ export declare function isSelected(event: Abstract): event is Selected;
60
+ /** @returns true iff event.type is EventType.CLICK */
61
+ export declare function isClick(event: Abstract): event is Click;
62
+ /** @returns true iff event.type is EventType.MARKER_MOVE */
63
+ export declare function isMarkerMove(event: Abstract): event is MarkerMove;
64
+ /** @returns true iff event.type is EventType.BUBBLE_OPEN */
65
+ export declare function isBubbleOpen(event: Abstract): event is BubbleOpen;
66
+ /** @returns true iff event.type is EventType.TRASHCAN_OPEN */
67
+ export declare function isTrashcanOpen(event: Abstract): event is TrashcanOpen;
68
+ /** @returns true iff event.type is EventType.TOOLBOX_ITEM_SELECT */
69
+ export declare function isToolboxItemSelect(event: Abstract): event is ToolboxItemSelect;
70
+ /** @returns true iff event.type is EventType.THEME_CHANGE */
71
+ export declare function isThemeChange(event: Abstract): event is ThemeChange;
72
+ /** @returns true iff event.type is EventType.VIEWPORT_CHANGE */
73
+ export declare function isViewportChange(event: Abstract): event is ViewportChange;
74
+ /** @returns true iff event.type is EventType.COMMENT_CREATE */
75
+ export declare function isCommentCreate(event: Abstract): event is CommentCreate;
76
+ /** @returns true iff event.type is EventType.COMMENT_DELETE */
77
+ export declare function isCommentDelete(event: Abstract): event is CommentDelete;
78
+ /** @returns true iff event.type is EventType.COMMENT_CHANGE */
79
+ export declare function isCommentChange(event: Abstract): event is CommentChange;
80
+ /** @returns true iff event.type is EventType.COMMENT_MOVE */
81
+ export declare function isCommentMove(event: Abstract): event is CommentMove;
82
+ /** @returns true iff event.type is EventType.COMMENT_RESIZE */
83
+ export declare function isCommentResize(event: Abstract): event is CommentResize;
84
+ /** @returns true iff event.type is EventType.COMMENT_DRAG */
85
+ export declare function isCommentDrag(event: Abstract): event is CommentDrag;
86
+ /** @returns true iff event.type is EventType.COMMENT_COLLAPSE */
87
+ export declare function isCommentCollapse(event: Abstract): event is CommentCollapse;
88
+ /** @returns true iff event.type is EventType.FINISHED_LOADING */
89
+ export declare function isFinishedLoading(event: Abstract): event is FinishedLoading;
90
+ //# sourceMappingURL=predicates.d.ts.map
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Enum of values for the .type property for event classes (concrete subclasses
8
+ * of Abstract).
9
+ */
10
+ export declare enum EventType {
11
+ /** Type of event that creates a block. */
12
+ BLOCK_CREATE = "create",
13
+ /** Type of event that deletes a block. */
14
+ BLOCK_DELETE = "delete",
15
+ /** Type of event that changes a block. */
16
+ BLOCK_CHANGE = "change",
17
+ /**
18
+ * Type of event representing an in-progress change to a field of a
19
+ * block, which is expected to be followed by a block change event.
20
+ */
21
+ BLOCK_FIELD_INTERMEDIATE_CHANGE = "block_field_intermediate_change",
22
+ /** Type of event that moves a block. */
23
+ BLOCK_MOVE = "move",
24
+ /** Type of event that creates a variable. */
25
+ VAR_CREATE = "var_create",
26
+ /** Type of event that deletes a variable. */
27
+ VAR_DELETE = "var_delete",
28
+ /** Type of event that renames a variable. */
29
+ VAR_RENAME = "var_rename",
30
+ /**
31
+ * Type of generic event that records a UI change.
32
+ *
33
+ * @deprecated Was only ever intended for internal use.
34
+ */
35
+ UI = "ui",
36
+ /** Type of event that drags a block. */
37
+ BLOCK_DRAG = "drag",
38
+ /** Type of event that records a change in selected element. */
39
+ SELECTED = "selected",
40
+ /** Type of event that records a click. */
41
+ CLICK = "click",
42
+ /** Type of event that records a marker move. */
43
+ MARKER_MOVE = "marker_move",
44
+ /** Type of event that records a bubble open. */
45
+ BUBBLE_OPEN = "bubble_open",
46
+ /** Type of event that records a trashcan open. */
47
+ TRASHCAN_OPEN = "trashcan_open",
48
+ /** Type of event that records a toolbox item select. */
49
+ TOOLBOX_ITEM_SELECT = "toolbox_item_select",
50
+ /** Type of event that records a theme change. */
51
+ THEME_CHANGE = "theme_change",
52
+ /** Type of event that records a viewport change. */
53
+ VIEWPORT_CHANGE = "viewport_change",
54
+ /** Type of event that creates a comment. */
55
+ COMMENT_CREATE = "comment_create",
56
+ /** Type of event that deletes a comment. */
57
+ COMMENT_DELETE = "comment_delete",
58
+ /** Type of event that changes a comment. */
59
+ COMMENT_CHANGE = "comment_change",
60
+ /** Type of event that moves a comment. */
61
+ COMMENT_MOVE = "comment_move",
62
+ /** Type of event that resizes a comment. */
63
+ COMMENT_RESIZE = "comment_resize",
64
+ /** Type of event that drags a comment. */
65
+ COMMENT_DRAG = "comment_drag",
66
+ /** Type of event that collapses a comment. */
67
+ COMMENT_COLLAPSE = "comment_collapse",
68
+ /** Type of event that records a workspace load. */
69
+ FINISHED_LOADING = "finished_loading"
70
+ }
71
+ /**
72
+ * List of events that cause objects to be bumped back into the visible
73
+ * portion of the workspace.
74
+ *
75
+ * Not to be confused with bumping so that disconnected connections do not
76
+ * appear connected.
77
+ */
78
+ export declare const BUMP_EVENTS: string[];
79
+ //# sourceMappingURL=type.d.ts.map