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.
Files changed (160) hide show
  1. package/README.md +9 -7
  2. package/blockly.min.js +1304 -1404
  3. package/blockly_compressed.js +1057 -1099
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +120 -136
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +59 -32
  8. package/core/block_dragger.d.ts +2 -2
  9. package/core/block_svg.d.ts +38 -67
  10. package/core/blockly.d.ts +18 -112
  11. package/core/browser_events.d.ts +1 -2
  12. package/core/bubble_dragger.d.ts +1 -2
  13. package/core/{bubble.d.ts → bubble_old.d.ts} +3 -7
  14. package/core/bubbles/bubble.d.ts +174 -0
  15. package/core/bubbles/mini_workspace_bubble.d.ts +80 -0
  16. package/core/bubbles/text_bubble.d.ts +35 -0
  17. package/core/bubbles/textinput_bubble.d.ts +89 -0
  18. package/core/bump_objects.d.ts +6 -4
  19. package/core/connection.d.ts +19 -9
  20. package/core/connection_db.d.ts +4 -4
  21. package/core/contextmenu.d.ts +1 -2
  22. package/core/events/events.d.ts +1 -4
  23. package/core/events/events_abstract.d.ts +0 -6
  24. package/core/events/events_block_base.d.ts +0 -6
  25. package/core/events/events_block_change.d.ts +0 -6
  26. package/core/events/events_block_create.d.ts +0 -6
  27. package/core/events/events_block_delete.d.ts +0 -6
  28. package/core/events/events_block_drag.d.ts +0 -6
  29. package/core/events/events_block_move.d.ts +21 -7
  30. package/core/events/events_bubble_open.d.ts +0 -6
  31. package/core/events/events_click.d.ts +0 -6
  32. package/core/events/events_comment_base.d.ts +0 -6
  33. package/core/events/events_comment_change.d.ts +0 -6
  34. package/core/events/events_comment_create.d.ts +0 -6
  35. package/core/events/events_comment_move.d.ts +0 -6
  36. package/core/events/events_marker_move.d.ts +0 -6
  37. package/core/events/events_selected.d.ts +0 -6
  38. package/core/events/events_theme_change.d.ts +0 -6
  39. package/core/events/events_toolbox_item_select.d.ts +0 -6
  40. package/core/events/events_trashcan_open.d.ts +0 -6
  41. package/core/events/events_var_base.d.ts +0 -6
  42. package/core/events/events_var_create.d.ts +0 -6
  43. package/core/events/events_var_delete.d.ts +0 -6
  44. package/core/events/events_var_rename.d.ts +0 -6
  45. package/core/events/events_viewport.d.ts +0 -6
  46. package/core/events/utils.d.ts +1 -1
  47. package/core/events/workspace_events.d.ts +1 -16
  48. package/core/field.d.ts +31 -5
  49. package/core/field_checkbox.d.ts +1 -1
  50. package/core/field_colour.d.ts +0 -2
  51. package/core/field_dropdown.d.ts +11 -13
  52. package/core/field_image.d.ts +5 -5
  53. package/core/field_input.d.ts +9 -2
  54. package/core/field_label.d.ts +3 -1
  55. package/core/field_number.d.ts +4 -4
  56. package/core/field_variable.d.ts +5 -5
  57. package/core/flyout_base.d.ts +23 -25
  58. package/core/flyout_button.d.ts +9 -9
  59. package/core/flyout_horizontal.d.ts +1 -1
  60. package/core/flyout_vertical.d.ts +1 -1
  61. package/core/generator.d.ts +15 -2
  62. package/core/gesture.d.ts +58 -41
  63. package/core/icons/comment_icon.d.ts +108 -0
  64. package/core/icons/exceptions.d.ts +14 -0
  65. package/core/icons/icon.d.ts +38 -0
  66. package/core/icons/icon_types.d.ts +22 -0
  67. package/core/icons/mutator_icon.d.ts +90 -0
  68. package/core/icons/registry.d.ts +23 -0
  69. package/core/icons/warning_icon.d.ts +67 -0
  70. package/core/icons.d.ts +12 -0
  71. package/core/inputs/dummy_input.d.ts +20 -0
  72. package/core/{input.d.ts → inputs/input.d.ts} +20 -13
  73. package/core/{input_types.d.ts → inputs/input_types.d.ts} +2 -1
  74. package/core/inputs/statement_input.d.ts +22 -0
  75. package/core/inputs/value_input.d.ts +20 -0
  76. package/core/interfaces/i_block_dragger.d.ts +1 -1
  77. package/core/interfaces/i_bounded_element.d.ts +2 -1
  78. package/core/interfaces/i_bubble.d.ts +2 -14
  79. package/core/interfaces/i_has_bubble.d.ts +14 -0
  80. package/core/interfaces/i_icon.d.ts +75 -0
  81. package/core/interfaces/i_serializable.d.ts +24 -0
  82. package/core/keyboard_nav/ast_node.d.ts +15 -15
  83. package/core/keyboard_nav/basic_cursor.d.ts +2 -2
  84. package/core/keyboard_nav/marker.d.ts +2 -2
  85. package/core/main.d.ts +0 -10
  86. package/core/marker_manager.d.ts +0 -1
  87. package/core/names.d.ts +4 -4
  88. package/core/options.d.ts +3 -3
  89. package/core/procedures.d.ts +1 -4
  90. package/core/registry.d.ts +5 -0
  91. package/core/render_management.d.ts +9 -1
  92. package/core/rendered_connection.d.ts +7 -7
  93. package/core/renderers/common/block_rendering.d.ts +0 -10
  94. package/core/renderers/common/constants.d.ts +5 -7
  95. package/core/renderers/common/drawer.d.ts +7 -2
  96. package/core/renderers/common/info.d.ts +1 -4
  97. package/core/renderers/common/marker_svg.d.ts +4 -4
  98. package/core/renderers/common/renderer.d.ts +0 -9
  99. package/core/renderers/geras/highlighter.d.ts +1 -1
  100. package/core/renderers/geras/info.d.ts +1 -1
  101. package/core/renderers/geras/measurables/inline_input.d.ts +1 -1
  102. package/core/renderers/geras/measurables/statement_input.d.ts +1 -1
  103. package/core/renderers/geras/renderer.d.ts +1 -1
  104. package/core/renderers/measurables/external_value_input.d.ts +1 -1
  105. package/core/renderers/measurables/field.d.ts +1 -1
  106. package/core/renderers/measurables/icon.d.ts +5 -1
  107. package/core/renderers/measurables/inline_input.d.ts +1 -1
  108. package/core/renderers/measurables/input_connection.d.ts +1 -1
  109. package/core/renderers/measurables/statement_input.d.ts +1 -1
  110. package/core/renderers/zelos/constants.d.ts +2 -2
  111. package/core/renderers/zelos/info.d.ts +2 -2
  112. package/core/renderers/zelos/marker_svg.d.ts +3 -3
  113. package/core/renderers/zelos/measurables/inputs.d.ts +1 -1
  114. package/core/renderers/zelos/path_object.d.ts +3 -3
  115. package/core/scrollbar.d.ts +0 -2
  116. package/core/scrollbar_pair.d.ts +0 -2
  117. package/core/serialization/blocks.d.ts +3 -3
  118. package/core/serialization/exceptions.d.ts +11 -0
  119. package/core/shortcut_registry.d.ts +2 -2
  120. package/core/theme_manager.d.ts +0 -1
  121. package/core/touch.d.ts +0 -43
  122. package/core/trashcan.d.ts +19 -21
  123. package/core/utils/dom.d.ts +2 -2
  124. package/core/utils/object.d.ts +0 -25
  125. package/core/utils/rect.d.ts +2 -0
  126. package/core/utils/style.d.ts +0 -12
  127. package/core/utils/svg_math.d.ts +0 -8
  128. package/core/utils/xml.d.ts +15 -22
  129. package/core/utils.d.ts +0 -138
  130. package/core/widgetdiv.d.ts +5 -0
  131. package/core/workspace.d.ts +9 -3
  132. package/core/workspace_comment.d.ts +3 -3
  133. package/core/workspace_comment_svg.d.ts +31 -44
  134. package/core/workspace_dragger.d.ts +1 -4
  135. package/core/workspace_svg.d.ts +13 -50
  136. package/core/xml.d.ts +0 -12
  137. package/core-browser.js +0 -1
  138. package/core.js +0 -1
  139. package/dart_compressed.js +124 -159
  140. package/dart_compressed.js.map +1 -1
  141. package/javascript_compressed.js +127 -169
  142. package/javascript_compressed.js.map +1 -1
  143. package/lua_compressed.js +119 -142
  144. package/lua_compressed.js.map +1 -1
  145. package/msg/constants.d.ts +1 -3
  146. package/msg/msg.d.ts +1 -2
  147. package/msg/qqq.d.ts +1 -3
  148. package/msg/synonyms.d.ts +1 -3
  149. package/package.json +12 -13
  150. package/php_compressed.js +131 -161
  151. package/php_compressed.js.map +1 -1
  152. package/python_compressed.js +118 -149
  153. package/python_compressed.js.map +1 -1
  154. package/core/comment.d.ts +0 -115
  155. package/core/events/events_ui.d.ts +0 -40
  156. package/core/icon.d.ts +0 -89
  157. package/core/mutator.d.ts +0 -142
  158. package/core/renderers/common/debug.d.ts +0 -29
  159. package/core/renderers/common/debugger.d.ts +0 -117
  160. package/core/warning.d.ts +0 -53
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import { IconType } from './icon_types.js';
8
+ import { Coordinate } from '../utils.js';
9
+ import { Icon } from './icon.js';
10
+ import type { IHasBubble } from '../interfaces/i_has_bubble.js';
11
+ import type { ISerializable } from '../interfaces/i_serializable.js';
12
+ import { Size } from '../utils/size.js';
13
+ export declare class CommentIcon extends Icon implements IHasBubble, ISerializable {
14
+ protected readonly sourceBlock: Block;
15
+ /** The type string used to identify this icon. */
16
+ static readonly TYPE: IconType<CommentIcon>;
17
+ /**
18
+ * The weight this icon has relative to other icons. Icons with more positive
19
+ * weight values are rendered farther toward the end of the block.
20
+ */
21
+ static readonly WEIGHT = 3;
22
+ /** The bubble used to show editable text to the user. */
23
+ private textInputBubble;
24
+ /** The bubble used to show non-editable text to the user. */
25
+ private textBubble;
26
+ /** The text of this comment. */
27
+ private text;
28
+ /** The size of this comment (which is applied to the editable bubble). */
29
+ private bubbleSize;
30
+ /**
31
+ * The visibility of the bubble for this comment.
32
+ *
33
+ * This is used to track what the visibile state /should/ be, not necessarily
34
+ * what it currently /is/. E.g. sometimes this will be true, but the block
35
+ * hasn't been rendered yet, so the bubble will not currently be visible.
36
+ */
37
+ private bubbleVisiblity;
38
+ constructor(sourceBlock: Block);
39
+ getType(): IconType<CommentIcon>;
40
+ initView(pointerdownListener: (e: PointerEvent) => void): void;
41
+ dispose(): void;
42
+ getWeight(): number;
43
+ getSize(): Size;
44
+ applyColour(): void;
45
+ /**
46
+ * Updates the state of the bubble (editable / noneditable) to reflect the
47
+ * state of the bubble if the bubble is currently shown.
48
+ */
49
+ updateEditable(): void;
50
+ onLocationChange(blockOrigin: Coordinate): void;
51
+ /** Sets the text of this comment. Updates any bubbles if they are visible. */
52
+ setText(text: string): void;
53
+ /** Returns the text of this comment. */
54
+ getText(): string;
55
+ /**
56
+ * Sets the size of the editable bubble for this comment. Resizes the
57
+ * bubble if it is visible.
58
+ */
59
+ setBubbleSize(size: Size): void;
60
+ /** @returns the size of the editable bubble for this comment. */
61
+ getBubbleSize(): Size;
62
+ /**
63
+ * @returns the state of the comment as a JSON serializable value if the
64
+ * comment has text. Otherwise returns null.
65
+ */
66
+ saveState(): CommentState | null;
67
+ /** Applies the given state to this comment. */
68
+ loadState(state: CommentState): void;
69
+ onClick(): void;
70
+ /**
71
+ * Updates the text of this comment in response to changes in the text of
72
+ * the input bubble.
73
+ */
74
+ onTextChange(): void;
75
+ /**
76
+ * Updates the size of this icon in response to changes in the size of the
77
+ * input bubble.
78
+ */
79
+ onSizeChange(): void;
80
+ bubbleIsVisible(): boolean;
81
+ setBubbleVisible(visible: boolean): void;
82
+ /**
83
+ * Shows the editable text bubble for this comment, and adds change listeners
84
+ * to update the state of this icon in response to changes in the bubble.
85
+ */
86
+ private showEditableBubble;
87
+ /** Shows the non editable text bubble for this comment. */
88
+ private showNonEditableBubble;
89
+ /** Hides any open bubbles owned by this comment. */
90
+ private hideBubble;
91
+ /**
92
+ * @returns the location the bubble should be anchored to.
93
+ * I.E. the middle of this icon.
94
+ */
95
+ private getAnchorLocation;
96
+ /**
97
+ * @returns the rect the bubble should avoid overlapping.
98
+ * I.E. the block that owns this icon.
99
+ */
100
+ private getBubbleOwnerRect;
101
+ }
102
+ export interface CommentState {
103
+ text?: string;
104
+ pinned?: boolean;
105
+ height?: number;
106
+ width?: number;
107
+ }
108
+ //# sourceMappingURL=comment_icon.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IIcon } from '../interfaces/i_icon.js';
7
+ export declare class DuplicateIconType extends Error {
8
+ icon: IIcon;
9
+ /**
10
+ * @internal
11
+ */
12
+ constructor(icon: IIcon);
13
+ }
14
+ //# sourceMappingURL=exceptions.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import type { IIcon } from '../interfaces/i_icon.js';
8
+ import { Coordinate } from '../utils/coordinate.js';
9
+ import { Size } from '../utils/size.js';
10
+ import type { IconType } from './icon_types.js';
11
+ export declare abstract class Icon implements IIcon {
12
+ protected sourceBlock: Block;
13
+ /**
14
+ * The position of this icon relative to its blocks top-start,
15
+ * in workspace units.
16
+ */
17
+ protected offsetInBlock: Coordinate;
18
+ /** The position of this icon in workspace coordinates. */
19
+ protected workspaceLocation: Coordinate;
20
+ /** The root svg element visually representing this icon. */
21
+ protected svgRoot: SVGGElement | null;
22
+ constructor(sourceBlock: Block);
23
+ getType(): IconType<IIcon>;
24
+ initView(pointerdownListener: (e: PointerEvent) => void): void;
25
+ dispose(): void;
26
+ getWeight(): number;
27
+ getSize(): Size;
28
+ applyColour(): void;
29
+ updateEditable(): void;
30
+ updateCollapsed(): void;
31
+ hideForInsertionMarker(): void;
32
+ isShownWhenCollapsed(): boolean;
33
+ setOffsetInBlock(offset: Coordinate): void;
34
+ private updateSvgRootOffset;
35
+ onLocationChange(blockOrigin: Coordinate): void;
36
+ onClick(): void;
37
+ }
38
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { IIcon } from '../interfaces/i_icon.js';
7
+ import { CommentIcon } from './comment_icon.js';
8
+ import { MutatorIcon } from './mutator_icon.js';
9
+ import { WarningIcon } from './warning_icon.js';
10
+ export declare class IconType<_T extends IIcon> {
11
+ private readonly name;
12
+ /** @param name The name of the registry type. */
13
+ constructor(name: string);
14
+ /** @returns the name of the type. */
15
+ toString(): string;
16
+ /** @returns true if this icon type is equivalent to the given icon type. */
17
+ equals(type: IconType<IIcon>): boolean;
18
+ static MUTATOR: IconType<MutatorIcon>;
19
+ static WARNING: IconType<WarningIcon>;
20
+ static COMMENT: IconType<CommentIcon>;
21
+ }
22
+ //# sourceMappingURL=icon_types.d.ts.map
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Abstract } from '../events/events_abstract.js';
7
+ import type { Block } from '../block.js';
8
+ import type { BlockSvg } from '../block_svg.js';
9
+ import type { Connection } from '../connection.js';
10
+ import { Coordinate } from '../utils/coordinate.js';
11
+ import type { IHasBubble } from '../interfaces/i_has_bubble.js';
12
+ import { Icon } from './icon.js';
13
+ import { Size } from '../utils/size.js';
14
+ import type { WorkspaceSvg } from '../workspace_svg.js';
15
+ import { IconType } from './icon_types.js';
16
+ export declare class MutatorIcon extends Icon implements IHasBubble {
17
+ private readonly flyoutBlockTypes;
18
+ protected readonly sourceBlock: BlockSvg;
19
+ /** The type string used to identify this icon. */
20
+ static readonly TYPE: IconType<MutatorIcon>;
21
+ /**
22
+ * The weight this icon has relative to other icons. Icons with more positive
23
+ * weight values are rendered farther toward the end of the block.
24
+ */
25
+ static readonly WEIGHT = 1;
26
+ /** The bubble used to show the mini workspace to the user. */
27
+ private miniWorkspaceBubble;
28
+ /** The root block in the mini workspace. */
29
+ private rootBlock;
30
+ /** The PID tracking updating the workkspace in response to user events. */
31
+ private updateWorkspacePid;
32
+ constructor(flyoutBlockTypes: string[], sourceBlock: BlockSvg);
33
+ getType(): IconType<MutatorIcon>;
34
+ initView(pointerdownListener: (e: PointerEvent) => void): void;
35
+ dispose(): void;
36
+ getWeight(): number;
37
+ getSize(): Size;
38
+ applyColour(): void;
39
+ updateCollapsed(): void;
40
+ onLocationChange(blockOrigin: Coordinate): void;
41
+ onClick(): void;
42
+ bubbleIsVisible(): boolean;
43
+ setBubbleVisible(visible: boolean): void;
44
+ /** @returns the configuration the mini workspace should have. */
45
+ private getMiniWorkspaceConfig;
46
+ /**
47
+ * @returns the location the bubble should be anchored to.
48
+ * I.E. the middle of this icon.
49
+ */
50
+ private getAnchorLocation;
51
+ /**
52
+ * @returns the rect the bubble should avoid overlapping.
53
+ * I.E. the block that owns this icon.
54
+ */
55
+ private getBubbleOwnerRect;
56
+ /** Decomposes the source block to create blocks in the mini workspace. */
57
+ private createRootBlock;
58
+ /** Adds a listen to the source block that triggers saving connections. */
59
+ private addSaveConnectionsListener;
60
+ /**
61
+ * Creates a change listener to add to the mini workspace which recomposes
62
+ * the block.
63
+ */
64
+ private createMiniWorkspaceChangeListener;
65
+ /**
66
+ * Returns true if the given event is not one the mutator needs to
67
+ * care about.
68
+ *
69
+ * @internal
70
+ */
71
+ static isIgnorableMutatorEvent(e: Abstract): boolean;
72
+ /** Recomposes the source block based on changes to the mini workspace. */
73
+ private recomposeSourceBlock;
74
+ /** @internal */
75
+ getWorkspace(): WorkspaceSvg | undefined;
76
+ /**
77
+ * Reconnects the given connection to the mutated input on the given block.
78
+ *
79
+ * @deprecated Use connection.reconnect instead. To be removed in v11.
80
+ */
81
+ static reconnect(connectionChild: Connection | null, block: Block, inputName: string): boolean;
82
+ /**
83
+ * Returns the parent workspace of a workspace that is inside a mini workspace
84
+ * bubble, taking into account whether the workspace is a flyout.
85
+ *
86
+ * @deprecated Use workspace.getRootWorkspace. To be removed in v11.
87
+ */
88
+ static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg | null;
89
+ }
90
+ //# sourceMappingURL=mutator_icon.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import type { IIcon } from '../interfaces/i_icon.js';
8
+ import { IconType } from './icon_types.js';
9
+ /**
10
+ * Registers the given icon so that it can be deserialized.
11
+ *
12
+ * @param type The type of the icon to register. This should be the same string
13
+ * that is returned from its `getType` method.
14
+ * @param iconConstructor The icon class/constructor to register.
15
+ */
16
+ export declare function register(type: IconType<IIcon>, iconConstructor: new (block: Block) => IIcon): void;
17
+ /**
18
+ * Unregisters the icon associated with the given type.
19
+ *
20
+ * @param type The type of the icon to unregister.
21
+ */
22
+ export declare function unregister(type: string): void;
23
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../block_svg.js';
7
+ import { Coordinate } from '../utils/coordinate.js';
8
+ import { Icon } from './icon.js';
9
+ import type { IHasBubble } from '../interfaces/i_has_bubble.js';
10
+ import { Size } from '../utils.js';
11
+ import { IconType } from './icon_types.js';
12
+ export declare class WarningIcon extends Icon implements IHasBubble {
13
+ protected readonly sourceBlock: BlockSvg;
14
+ /** The type string used to identify this icon. */
15
+ static readonly TYPE: IconType<WarningIcon>;
16
+ /**
17
+ * The weight this icon has relative to other icons. Icons with more positive
18
+ * weight values are rendered farther toward the end of the block.
19
+ */
20
+ static readonly WEIGHT = 2;
21
+ /** A map of warning IDs to warning text. */
22
+ private textMap;
23
+ /** The bubble used to display the warnings to the user. */
24
+ private textBubble;
25
+ /** @internal */
26
+ constructor(sourceBlock: BlockSvg);
27
+ getType(): IconType<WarningIcon>;
28
+ initView(pointerdownListener: (e: PointerEvent) => void): void;
29
+ dispose(): void;
30
+ getWeight(): number;
31
+ getSize(): Size;
32
+ applyColour(): void;
33
+ updateCollapsed(): void;
34
+ /** Tells blockly that this icon is shown when the block is collapsed. */
35
+ isShownWhenCollapsed(): boolean;
36
+ /** Updates the location of the icon's bubble if it is open. */
37
+ onLocationChange(blockOrigin: Coordinate): void;
38
+ /**
39
+ * Adds a warning message to this warning icon.
40
+ *
41
+ * @param text The text of the message to add.
42
+ * @param id The id of the message to add.
43
+ * @internal
44
+ */
45
+ addMessage(text: string, id: string): this;
46
+ /**
47
+ * @returns the display text for this icon. Includes all warning messages
48
+ * concatenated together with newlines.
49
+ * @internal
50
+ */
51
+ getText(): string;
52
+ /** Toggles the visibility of the bubble. */
53
+ onClick(): void;
54
+ bubbleIsVisible(): boolean;
55
+ setBubbleVisible(visible: boolean): void;
56
+ /**
57
+ * @returns the location the bubble should be anchored to.
58
+ * I.E. the middle of this icon.
59
+ */
60
+ private getAnchorLocation;
61
+ /**
62
+ * @returns the rect the bubble should avoid overlapping.
63
+ * I.E. the block that owns this icon.
64
+ */
65
+ private getBubbleOwnerRect;
66
+ }
67
+ //# sourceMappingURL=warning_icon.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CommentIcon } from './icons/comment_icon.js';
7
+ import * as exceptions from './icons/exceptions.js';
8
+ import * as registry from './icons/registry.js';
9
+ import { MutatorIcon } from './icons/mutator_icon.js';
10
+ import { IconType } from './icons/icon_types.js';
11
+ export { CommentIcon, exceptions, registry, MutatorIcon, IconType };
12
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import { Input } from './input.js';
8
+ import { inputTypes } from './input_types.js';
9
+ /** Represents an input on a block with no connection. */
10
+ export declare class DummyInput extends Input {
11
+ name: string;
12
+ readonly type = inputTypes.DUMMY;
13
+ /**
14
+ * @param name Language-neutral identifier which may used to find this input
15
+ * again.
16
+ * @param block The block containing this input.
17
+ */
18
+ constructor(name: string, block: Block);
19
+ }
20
+ //# sourceMappingURL=dummy_input.d.ts.map
@@ -3,32 +3,32 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import './field_label.js';
7
- import type { Block } from './block.js';
8
- import type { BlockSvg } from './block_svg.js';
9
- import type { Connection } from './connection.js';
10
- import type { Field } from './field.js';
6
+ import '../field_label.js';
7
+ import type { Block } from '../block.js';
8
+ import type { BlockSvg } from '../block_svg.js';
9
+ import type { Connection } from '../connection.js';
10
+ import type { ConnectionType } from '../connection_type.js';
11
+ import type { Field } from '../field.js';
12
+ import { inputTypes } from './input_types.js';
11
13
  /**
12
14
  * Class for an input with an optional field.
13
15
  */
14
16
  export declare class Input {
15
- type: number;
16
17
  name: string;
17
- connection: Connection | null;
18
18
  private sourceBlock;
19
19
  fieldRow: Field[];
20
20
  /** Alignment of input's fields (left, right or centre). */
21
21
  align: Input.Align;
22
22
  /** Is the input visible? */
23
23
  private visible;
24
+ readonly type: inputTypes;
25
+ connection: Connection | null;
24
26
  /**
25
- * @param type The type of the input.
26
27
  * @param name Language-neutral identifier which may used to find this input
27
28
  * again.
28
- * @param block The block containing this input.
29
- * @param connection Optional connection for this input.
29
+ * @param sourceBlock The block containing this input.
30
30
  */
31
- constructor(type: number, name: string, block: Block, connection: Connection | null);
31
+ constructor(name: string, sourceBlock: Block);
32
32
  /**
33
33
  * Get the source block for this input.
34
34
  *
@@ -120,10 +120,17 @@ export declare class Input {
120
120
  init(): void;
121
121
  /**
122
122
  * Sever all links to this input.
123
- *
124
- * @suppress {checkTypes}
125
123
  */
126
124
  dispose(): void;
125
+ /**
126
+ * Constructs a connection based on the type of this input's source block.
127
+ * Properly handles constructing headless connections for headless blocks
128
+ * and rendered connections for rendered blocks.
129
+ *
130
+ * @returns a connection of the given type, which is either a headless
131
+ * or rendered connection, based on the type of this input's source block.
132
+ */
133
+ protected makeConnection(type: ConnectionType): Connection;
127
134
  }
128
135
  export declare namespace Input {
129
136
  /**
@@ -9,6 +9,7 @@
9
9
  export declare enum inputTypes {
10
10
  VALUE = 1,
11
11
  STATEMENT = 3,
12
- DUMMY = 5
12
+ DUMMY = 5,
13
+ CUSTOM = 6
13
14
  }
14
15
  //# sourceMappingURL=input_types.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import type { Connection } from '../connection.js';
8
+ import { Input } from './input.js';
9
+ import { inputTypes } from './input_types.js';
10
+ /** Represents an input on a block with a statement connection. */
11
+ export declare class StatementInput extends Input {
12
+ name: string;
13
+ readonly type = inputTypes.STATEMENT;
14
+ connection: Connection;
15
+ /**
16
+ * @param name Language-neutral identifier which may used to find this input
17
+ * again.
18
+ * @param block The block containing this input.
19
+ */
20
+ constructor(name: string, block: Block);
21
+ }
22
+ //# sourceMappingURL=statement_input.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Block } from '../block.js';
7
+ import { Input } from './input.js';
8
+ import { inputTypes } from './input_types.js';
9
+ /** Represents an input on a block with a value connection. */
10
+ export declare class ValueInput extends Input {
11
+ name: string;
12
+ readonly type = inputTypes.VALUE;
13
+ /**
14
+ * @param name Language-neutral identifier which may used to find this input
15
+ * again.
16
+ * @param block The block containing this input.
17
+ */
18
+ constructor(name: string, block: Block);
19
+ }
20
+ //# sourceMappingURL=value_input.d.ts.map
@@ -10,7 +10,7 @@ import type { BlockSvg } from '../block_svg.js';
10
10
  */
11
11
  export interface IBlockDragger {
12
12
  /**
13
- * Start dragging a block. This includes moving it to the drag surface.
13
+ * Start dragging a block.
14
14
  *
15
15
  * @param currentDragDeltaXY How far the pointer has moved from the position
16
16
  * at mouse down, in pixel units.
@@ -20,7 +20,8 @@ export interface IBoundedElement {
20
20
  *
21
21
  * @param dx Horizontal offset in workspace units.
22
22
  * @param dy Vertical offset in workspace units.
23
+ * @param reason Why is this move happening? 'user', 'bump', 'snap'...
23
24
  */
24
- moveBy(dx: number, dy: number): void;
25
+ moveBy(dx: number, dy: number, reason?: string[]): void;
25
26
  }
26
27
  //# sourceMappingURL=i_bounded_element.d.ts.map
@@ -4,7 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Coordinate } from '../utils/coordinate.js';
7
- import type { BlockDragSurfaceSvg } from '../block_drag_surface.js';
8
7
  import type { IContextMenu } from './i_contextmenu.js';
9
8
  import type { IDraggable } from './i_draggable.js';
10
9
  /**
@@ -24,14 +23,6 @@ export interface IBubble extends IDraggable, IContextMenu {
24
23
  * @returns The root SVG node of the bubble's group.
25
24
  */
26
25
  getSvgRoot(): SVGElement;
27
- /**
28
- * Set whether auto-layout of this bubble is enabled. The first time a bubble
29
- * is shown it positions itself to not cover any blocks. Once a user has
30
- * dragged it to reposition, it renders where the user put it.
31
- *
32
- * @param enable True if auto-layout should be enabled, false otherwise.
33
- */
34
- setAutoLayout(enable: boolean): void;
35
26
  /**
36
27
  * Sets whether or not this bubble is being dragged.
37
28
  *
@@ -39,14 +30,11 @@ export interface IBubble extends IDraggable, IContextMenu {
39
30
  */
40
31
  setDragging(dragging: boolean): void;
41
32
  /**
42
- * Move this bubble during a drag, taking into account whether or not there is
43
- * a drag surface.
33
+ * Move this bubble during a drag.
44
34
  *
45
- * @param dragSurface The surface that carries rendered items during a drag,
46
- * or null if no drag surface is in use.
47
35
  * @param newLoc The location to translate to, in workspace coordinates.
48
36
  */
49
- moveDuringDrag(dragSurface: BlockDragSurfaceSvg | null, newLoc: Coordinate): void;
37
+ moveDuringDrag(newLoc: Coordinate): void;
50
38
  /**
51
39
  * Move the bubble to the specified location in workspace coordinates.
52
40
  *
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export interface IHasBubble {
7
+ /** @returns True if the bubble is currently open, false otherwise. */
8
+ bubbleIsVisible(): boolean;
9
+ /** Sets whether the bubble is open or not. */
10
+ setBubbleVisible(visible: boolean): void;
11
+ }
12
+ /** Type guard that checks whether the given object is a IHasBubble. */
13
+ export declare function hasBubble(obj: any): obj is IHasBubble;
14
+ //# sourceMappingURL=i_has_bubble.d.ts.map
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IconType } from '../icons/icon_types.js';
7
+ import type { Coordinate } from '../utils/coordinate.js';
8
+ import type { Size } from '../utils/size.js';
9
+ export interface IIcon {
10
+ /**
11
+ * @returns the IconType representing the type of the icon. This value should
12
+ * also be used to register the icon via `Blockly.icons.registry.register`.
13
+ */
14
+ getType(): IconType<IIcon>;
15
+ /**
16
+ * Creates the SVG elements for the icon that will live on the block.
17
+ *
18
+ * @param pointerdownListener An event listener that must be attached to the
19
+ * root SVG element by the implementation of `initView`. Used by Blockly's
20
+ * gesture system to properly handle clicks and drags.
21
+ */
22
+ initView(pointerdownListener: (e: PointerEvent) => void): void;
23
+ /**
24
+ * Disposes of any elements of the icon.
25
+ *
26
+ * @remarks
27
+ *
28
+ * In particular, if this icon is currently showing a bubble, this should be
29
+ * used to hide it.
30
+ */
31
+ dispose(): void;
32
+ /**
33
+ * @returns the "weight" of the icon, which determines the static order which
34
+ * icons should be rendered in. More positive numbers are rendered farther
35
+ * toward the end of the block.
36
+ */
37
+ getWeight(): number;
38
+ /** @returns The dimensions of the icon for use in rendering. */
39
+ getSize(): Size;
40
+ /** Updates the icon's color when the block's color changes.. */
41
+ applyColour(): void;
42
+ /** Hides the icon when it is part of an insertion marker. */
43
+ hideForInsertionMarker(): void;
44
+ /** Updates the icon's editability when the block's editability changes. */
45
+ updateEditable(): void;
46
+ /**
47
+ * Updates the icon's collapsed-ness/view when the block's collapsed-ness
48
+ * changes.
49
+ */
50
+ updateCollapsed(): void;
51
+ /**
52
+ * @returns Whether this icon is shown when the block is collapsed. Used
53
+ * to allow renderers to account for padding.
54
+ */
55
+ isShownWhenCollapsed(): boolean;
56
+ /**
57
+ * Notifies the icon where it is relative to its block's top-start, in
58
+ * workspace units.
59
+ */
60
+ setOffsetInBlock(offset: Coordinate): void;
61
+ /**
62
+ * Notifies the icon that it has changed locations.
63
+ *
64
+ * @param blockOrigin The location of this icon's block's top-start corner
65
+ * in workspace coordinates.
66
+ */
67
+ onLocationChange(blockOrigin: Coordinate): void;
68
+ /**
69
+ * Notifies the icon that it has been clicked.
70
+ */
71
+ onClick(): void;
72
+ }
73
+ /** Type guard that checks whether the given object is an IIcon. */
74
+ export declare function isIcon(obj: any): obj is IIcon;
75
+ //# sourceMappingURL=i_icon.d.ts.map