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
@@ -77,7 +77,7 @@ export declare class ConstantProvider extends BaseConstantProvider {
77
77
  /**
78
78
  * The <filter> element to use for a selected glow, or null if not set.
79
79
  */
80
- private selectedGlowFilter_;
80
+ private selectedGlowFilter;
81
81
  /**
82
82
  * The ID of the replacement glow filter, or the empty string if no filter
83
83
  * is set.
@@ -86,7 +86,7 @@ export declare class ConstantProvider extends BaseConstantProvider {
86
86
  /**
87
87
  * The <filter> element to use for a replacement glow, or null if not set.
88
88
  */
89
- private replacementGlowFilter_;
89
+ private replacementGlowFilter;
90
90
  /**
91
91
  * The object containing information about the hexagon used for a boolean
92
92
  * reporter block. Null before init is called.
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
- import { Input } from '../../input.js';
7
+ import { Input } from '../../inputs/input.js';
8
8
  import { RenderInfo as BaseRenderInfo } from '../common/info.js';
9
9
  import type { Measurable } from '../measurables/base.js';
10
10
  import type { Row } from '../measurables/row.js';
@@ -29,7 +29,7 @@ export declare class RenderInfo extends BaseRenderInfo {
29
29
  isMultiRow: boolean;
30
30
  hasStatementInput: boolean;
31
31
  rightSide: RightConnectionShape | null;
32
- private readonly rightAlignedDummyInputs_;
32
+ private readonly rightAlignedDummyInputs;
33
33
  /**
34
34
  * @param renderer The renderer in use.
35
35
  * @param block The block to measure.
@@ -14,7 +14,7 @@ import type { ConstantProvider as ZelosConstantProvider } from './constants.js';
14
14
  */
15
15
  export declare class MarkerSvg extends BaseMarkerSvg {
16
16
  constants_: ZelosConstantProvider;
17
- private markerCircle_;
17
+ private markerCircle;
18
18
  /**
19
19
  * @param workspace The workspace the marker belongs to.
20
20
  * @param constants The constants for the renderer.
@@ -26,7 +26,7 @@ export declare class MarkerSvg extends BaseMarkerSvg {
26
26
  *
27
27
  * @param curNode The node to draw the marker for.
28
28
  */
29
- private showWithInputOutput_;
29
+ private showWithInputOutput;
30
30
  showWithOutput_(curNode: ASTNode): void;
31
31
  showWithInput_(curNode: ASTNode): void;
32
32
  /**
@@ -41,7 +41,7 @@ export declare class MarkerSvg extends BaseMarkerSvg {
41
41
  * @param x The x position of the circle.
42
42
  * @param y The y position of the circle.
43
43
  */
44
- private positionCircle_;
44
+ private positionCircle;
45
45
  hide(): void;
46
46
  createDomInternal_(): SVGGElement;
47
47
  applyColour_(curNode: ASTNode): void;
@@ -3,7 +3,7 @@
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { Input } from '../../../input.js';
6
+ import type { Input } from '../../../inputs/input.js';
7
7
  import type { ConstantProvider } from '../../../renderers/common/constants.js';
8
8
  import { StatementInput as BaseStatementInput } from '../../../renderers/measurables/statement_input.js';
9
9
  /**
@@ -14,7 +14,7 @@ import type { ConstantProvider } from './constants.js';
14
14
  */
15
15
  export declare class PathObject extends BasePathObject {
16
16
  /** The selected path of the block. */
17
- private svgPathSelected_;
17
+ private svgPathSelected;
18
18
  /** The outline paths on the block. */
19
19
  private readonly outlines;
20
20
  /**
@@ -64,12 +64,12 @@ export declare class PathObject extends BasePathObject {
64
64
  * @param name The input name.
65
65
  * @returns The SVG outline path.
66
66
  */
67
- private getOutlinePath_;
67
+ private getOutlinePath;
68
68
  /**
69
69
  * Remove an outline path that is associated with the specified input.
70
70
  *
71
71
  * @param name The input name.
72
72
  */
73
- private removeOutlinePath_;
73
+ private removeOutlinePath;
74
74
  }
75
75
  //# sourceMappingURL=path_object.d.ts.map
@@ -126,8 +126,6 @@ export declare class Scrollbar {
126
126
  /**
127
127
  * Dispose of this scrollbar. Remove DOM elements, event listeners,
128
128
  * and theme subscriptions.
129
- *
130
- * @suppress {checkTypes}
131
129
  */
132
130
  dispose(): void;
133
131
  /**
@@ -28,8 +28,6 @@ export declare class ScrollbarPair {
28
28
  /**
29
29
  * Dispose of this pair of scrollbars.
30
30
  * Unlink from all DOM elements to prevent memory leaks.
31
- *
32
- * @suppress {checkTypes}
33
31
  */
34
32
  dispose(): void;
35
33
  /**
@@ -11,8 +11,8 @@ import type { Workspace } from '../workspace.js';
11
11
  * Represents the state of a connection.
12
12
  */
13
13
  export interface ConnectionState {
14
- shadow: State | undefined;
15
- block: State | undefined;
14
+ shadow?: State;
15
+ block?: State;
16
16
  }
17
17
  /**
18
18
  * Represents the state of a given block.
@@ -93,7 +93,7 @@ export declare function append(state: State, workspace: Workspace, { recordUndo
93
93
  * @returns The block that was just appended.
94
94
  * @internal
95
95
  */
96
- export declare function appendInternal(state: State, workspace: Workspace, { parentConnection, isShadow, recordUndo }?: {
96
+ export declare function appendInternal(state: State, workspace: Workspace, { parentConnection, isShadow, recordUndo, }?: {
97
97
  parentConnection?: Connection;
98
98
  isShadow?: boolean;
99
99
  recordUndo?: boolean;
@@ -67,4 +67,15 @@ export declare class RealChildOfShadow extends DeserializationError {
67
67
  */
68
68
  constructor(state: State);
69
69
  }
70
+ export declare class UnregisteredIcon extends DeserializationError {
71
+ block: Block;
72
+ state: State;
73
+ /**
74
+ * @param iconType The type of the unregistered icon we are attempting to
75
+ * deserialize.
76
+ * @param block The block we are attempting to add the unregistered icon to.
77
+ * @param state The state object representing the block.
78
+ */
79
+ constructor(iconType: string, block: Block, state: State);
80
+ }
70
81
  //# sourceMappingURL=exceptions.d.ts.map
@@ -146,9 +146,9 @@ export declare class ShortcutRegistry {
146
146
  }
147
147
  export declare namespace ShortcutRegistry {
148
148
  interface KeyboardShortcut {
149
- callback?: ((p1: Workspace, p2: Event, p3: KeyboardShortcut) => boolean);
149
+ callback?: (p1: Workspace, p2: Event, p3: KeyboardShortcut) => boolean;
150
150
  name: string;
151
- preconditionFn?: ((p1: Workspace) => boolean);
151
+ preconditionFn?: (p1: Workspace) => boolean;
152
152
  metadata?: object;
153
153
  keyCodes?: (number | string)[];
154
154
  allowCollision?: boolean;
@@ -71,7 +71,6 @@ export declare class ThemeManager {
71
71
  /**
72
72
  * Dispose of this theme manager.
73
73
  *
74
- * @suppress {checkTypes}
75
74
  * @internal
76
75
  */
77
76
  dispose(): void;
package/core/touch.d.ts CHANGED
@@ -4,17 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Gesture } from './gesture.js';
7
- /**
8
- * A mock event, created from either a mouse or touch event,
9
- * with no more than one entry in the changedTouches array.
10
- */
11
- interface PseudoEvent {
12
- type: string;
13
- changedTouches: Touch[];
14
- target: Element;
15
- stopPropagation: () => void;
16
- preventDefault: () => void;
17
- }
18
7
  /**
19
8
  * Whether touch is enabled in the browser.
20
9
  * Copied from Closure's goog.events.BrowserFeature.TOUCH_ENABLED
@@ -80,36 +69,4 @@ export declare function getTouchIdentifierFromEvent(e: PointerEvent): string;
80
69
  * identifier.
81
70
  */
82
71
  export declare function checkTouchIdentifier(e: PointerEvent): boolean;
83
- /**
84
- * Set an event's clientX and clientY from its first changed touch. Use this to
85
- * make a touch event work in a mouse event handler.
86
- *
87
- * @param e A touch event.
88
- */
89
- export declare function setClientFromTouch(e: Event | PseudoEvent): void;
90
- /**
91
- * Check whether a given event is a mouse, touch, or pointer event.
92
- *
93
- * @param e An event.
94
- * @returns True if it is a mouse, touch, or pointer event; false otherwise.
95
- */
96
- export declare function isMouseOrTouchEvent(e: Event | PseudoEvent): boolean;
97
- /**
98
- * Check whether a given event is a touch event or a pointer event.
99
- *
100
- * @param e An event.
101
- * @returns True if it is a touch or pointer event; false otherwise.
102
- */
103
- export declare function isTouchEvent(e: Event | PseudoEvent): boolean;
104
- /**
105
- * Split an event into an array of events, one per changed touch or mouse
106
- * point.
107
- *
108
- * @param e A mouse event or a touch event with one or more changed touches.
109
- * @returns An array of events or pseudo events.
110
- * Each pseudo-touch event will have exactly one changed touch and there
111
- * will be no real touch events.
112
- */
113
- export declare function splitEventByTouches(e: Event): Array<Event | PseudoEvent>;
114
- export {};
115
72
  //# sourceMappingURL=touch.d.ts.map
@@ -25,7 +25,7 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
25
25
  /**
26
26
  * A list of JSON (stored as strings) representing blocks in the trashcan.
27
27
  */
28
- private readonly contents_;
28
+ private readonly contents;
29
29
  /**
30
30
  * The trashcan flyout.
31
31
  *
@@ -38,21 +38,21 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
38
38
  * The minimum openness of the lid. Used to indicate if the trashcan
39
39
  * contains blocks.
40
40
  */
41
- private minOpenness_;
41
+ private minOpenness;
42
42
  /** The SVG group containing the trash can. */
43
- private svgGroup_;
43
+ private svgGroup;
44
44
  /** The SVG image element of the trash can lid. */
45
- private svgLid_;
45
+ private svgLid;
46
46
  /** Task ID of opening/closing animation. */
47
- private lidTask_;
47
+ private lidTask;
48
48
  /** Current state of lid opening (0.0 = closed, 1.0 = open). */
49
- private lidOpen_;
49
+ private lidOpen;
50
50
  /** Left coordinate of the trash can. */
51
- private left_;
51
+ private left;
52
52
  /** Top coordinate of the trash can. */
53
- private top_;
53
+ private top;
54
54
  /** Whether this trash can has been initialized. */
55
- private initialized_;
55
+ private initialized;
56
56
  /** @param workspace The workspace to sit in. */
57
57
  constructor(workspace: WorkspaceSvg);
58
58
  /**
@@ -66,8 +66,6 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
66
66
  /**
67
67
  * Dispose of this trash can.
68
68
  * Unlink from all DOM elements to prevent memory leaks.
69
- *
70
- * @suppress {checkTypes}
71
69
  */
72
70
  dispose(): void;
73
71
  /**
@@ -75,7 +73,7 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
75
73
  *
76
74
  * @returns True if the trashcan has contents.
77
75
  */
78
- private hasContents_;
76
+ private hasContents;
79
77
  /**
80
78
  * Returns true if the trashcan contents-flyout is currently open.
81
79
  *
@@ -151,13 +149,13 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
151
149
  */
152
150
  setLidOpen(state: boolean): void;
153
151
  /** Rotate the lid open or closed by one step. Then wait and recurse. */
154
- private animateLid_;
152
+ private animateLid;
155
153
  /**
156
154
  * Set the angle of the trashcan's lid.
157
155
  *
158
156
  * @param lidAngle The angle at which to set the lid.
159
157
  */
160
- private setLidAngle_;
158
+ private setLidAngle;
161
159
  /**
162
160
  * Sets the minimum openness of the trashcan lid. If the lid is currently
163
161
  * closed, this will update lid's position.
@@ -165,7 +163,7 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
165
163
  * @param newMin The new minimum openness of the lid. Should be between 0
166
164
  * and 1.
167
165
  */
168
- private setMinOpenness_;
166
+ private setMinOpenness;
169
167
  /**
170
168
  * Flip the lid shut.
171
169
  * Called externally after a drag.
@@ -178,29 +176,29 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
178
176
  *
179
177
  * @param trashcanOpen Whether the flyout is opening.
180
178
  */
181
- private fireUiEvent_;
179
+ private fireUiEvent;
182
180
  /**
183
181
  * Prevents a workspace scroll and click event if the trashcan has blocks.
184
182
  *
185
183
  * @param e A mouse down event.
186
184
  */
187
- private blockMouseDownWhenOpenable_;
185
+ private blockMouseDownWhenOpenable;
188
186
  /**
189
187
  * Indicate that the trashcan can be clicked (by opening it) if it has blocks.
190
188
  */
191
- private mouseOver_;
189
+ private mouseOver;
192
190
  /**
193
191
  * Close the lid of the trashcan if it was open (Vis. it was indicating it had
194
192
  * blocks).
195
193
  */
196
- private mouseOut_;
194
+ private mouseOut;
197
195
  /**
198
196
  * Handle a BLOCK_DELETE event. Adds deleted blocks oldXml to the content
199
197
  * array.
200
198
  *
201
199
  * @param event Workspace event.
202
200
  */
203
- private onDelete_;
201
+ private onDelete;
204
202
  /**
205
203
  * Converts JSON representing a block into text that can be stored in the
206
204
  * content array.
@@ -209,6 +207,6 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
209
207
  * @returns A BlockInfo object corresponding to the JSON, cleaned of all
210
208
  * unnecessary attributes.
211
209
  */
212
- private cleanBlockJson_;
210
+ private cleanBlockJson;
213
211
  }
214
212
  //# sourceMappingURL=trashcan.d.ts.map
@@ -23,8 +23,7 @@ export declare const XLINK_NS = "http://www.w3.org/1999/xlink";
23
23
  export declare enum NodeType {
24
24
  ELEMENT_NODE = 1,
25
25
  TEXT_NODE = 3,
26
- COMMENT_NODE = 8,
27
- DOCUMENT_POSITION_CONTAINED_BY = 16
26
+ COMMENT_NODE = 8
28
27
  }
29
28
  /**
30
29
  * Helper method for creating SVG elements.
@@ -93,6 +92,7 @@ export declare function insertAfter(newNode: Element, refNode: Element): void;
93
92
  * @param parent The node that should contain the other node.
94
93
  * @param descendant The node to test presence of.
95
94
  * @returns Whether the parent node contains the descendant node.
95
+ * @deprecated Use native 'contains' DOM method.
96
96
  */
97
97
  export declare function containsNode(parent: Node, descendant: Node): boolean;
98
98
  /**
@@ -3,23 +3,6 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- /**
7
- * Inherit the prototype methods from one constructor into another.
8
- *
9
- * @param childCtor Child class.
10
- * @param parentCtor Parent class.
11
- * @suppress {strictMissingProperties} superClass_ is not defined on Function.
12
- * @deprecated No longer provided by Blockly.
13
- */
14
- export declare function inherits(childCtor: Function, parentCtor: Function): void;
15
- /**
16
- * Copies all the members of a source object to a target object.
17
- *
18
- * @param target Target.
19
- * @param source Source.
20
- * @deprecated Use the built-in **Object.assign** instead.
21
- */
22
- export declare function mixin(target: any, source: any): void;
23
6
  /**
24
7
  * Complete a deep merge of all members of a source object with a target object.
25
8
  *
@@ -28,12 +11,4 @@ export declare function mixin(target: any, source: any): void;
28
11
  * @returns The resulting object.
29
12
  */
30
13
  export declare function deepMerge(target: any, source: any): any;
31
- /**
32
- * Returns an array of a given object's own enumerable property values.
33
- *
34
- * @param obj Object containing values.
35
- * @returns Array of values.
36
- * @deprecated Use the built-in **Object.values** instead.
37
- */
38
- export declare function values(obj: any): any[];
39
14
  //# sourceMappingURL=object.d.ts.map
@@ -18,6 +18,8 @@ export declare class Rect {
18
18
  * @param right Right.
19
19
  */
20
20
  constructor(top: number, bottom: number, left: number, right: number);
21
+ getHeight(): number;
22
+ getWidth(): number;
21
23
  /**
22
24
  * Tests whether this rectangle contains a x/y coordinate.
23
25
  *
@@ -30,18 +30,6 @@ declare function getSizeInternal(element: Element): Size;
30
30
  * @returns Style value.
31
31
  */
32
32
  export declare function getComputedStyle(element: Element, property: string): string;
33
- /**
34
- * Gets the cascaded style value of a node, or null if the value cannot be
35
- * computed (only Internet Explorer can do this).
36
- *
37
- * Copied from Closure's goog.style.getCascadedStyle
38
- *
39
- * @param element Element to get style of.
40
- * @param style Property to get (camel-case).
41
- * @returns Style value.
42
- * @deprecated No longer provided by Blockly.
43
- */
44
- export declare function getCascadedStyle(element: Element, style: string): string;
45
33
  /**
46
34
  * Returns a Coordinate object relative to the top-left of the HTML document.
47
35
  * Similar to Closure's goog.style.getPageOffset
@@ -23,14 +23,6 @@ export declare function getRelativeXY(element: Element): Coordinate;
23
23
  * @returns Object with .x and .y properties.
24
24
  */
25
25
  export declare function getInjectionDivXY(element: Element): Coordinate;
26
- /**
27
- * Check if 3D transforms are supported by adding an element
28
- * and attempting to set the property.
29
- *
30
- * @returns True if 3D transforms are supported.
31
- * @deprecated No longer provided by Blockly.
32
- */
33
- export declare function is3dSupported(): boolean;
34
26
  /**
35
27
  * Get the position of the current viewport in window coordinates. This takes
36
28
  * scroll into account.
@@ -46,20 +46,6 @@ export declare function injectDependencies(dependencies: {
46
46
  * Namespace for Blockly's XML.
47
47
  */
48
48
  export declare const NAME_SPACE = "https://developers.google.com/blockly/xml";
49
- /**
50
- * Get the document object to use for XML serialization.
51
- *
52
- * @returns The document object.
53
- * @deprecated No longer provided by Blockly.
54
- */
55
- export declare function getDocument(): Document;
56
- /**
57
- * Get the document object to use for XML serialization.
58
- *
59
- * @param xmlDocument The document object to use.
60
- * @deprecated No longer provided by Blockly.
61
- */
62
- export declare function setDocument(xmlDocument: Document): void;
63
49
  /**
64
50
  * Create DOM element for XML.
65
51
  *
@@ -77,24 +63,31 @@ export declare function createTextNode(text: string): Text;
77
63
  /**
78
64
  * Converts an XML string into a DOM structure.
79
65
  *
66
+ * Control characters should be escaped. (But we will try to best-effort parse
67
+ * unescaped characters.)
68
+ *
69
+ * Note that even when escaped, U+0000 will be parsed as U+FFFD (the
70
+ * "replacement character") because U+0000 is never a valid XML character
71
+ * (even in XML 1.1).
72
+ * https://www.w3.org/TR/xml11/#charsets
73
+ *
80
74
  * @param text An XML string.
81
75
  * @returns A DOM object representing the singular child of the document
82
76
  * element.
83
77
  * @throws if the text doesn't parse.
84
78
  */
85
79
  export declare function textToDom(text: string): Element;
86
- /**
87
- * Converts an XML string into a DOM tree.
88
- *
89
- * @param text XML string.
90
- * @returns The DOM document.
91
- * @throws if XML doesn't parse.
92
- */
93
- export declare function textToDomDocument(text: string): Document;
94
80
  /**
95
81
  * Converts a DOM structure into plain text.
96
82
  * Currently the text format is fairly ugly: all one line with no whitespace.
97
83
  *
84
+ * Control characters are escaped using their decimal encodings. This includes
85
+ * U+0000 even though it is technically never a valid XML character (even in
86
+ * XML 1.1).
87
+ * https://www.w3.org/TR/xml11/#charsets
88
+ *
89
+ * When decoded U+0000 will be parsed as U+FFFD (the "replacement character").
90
+ *
98
91
  * @param dom A tree of XML nodes.
99
92
  * @returns Text representation.
100
93
  */
package/core/utils.d.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { Block } from './block.js';
7
6
  import * as browserEvents from './browser_events.js';
8
7
  import * as extensions from './extensions.js';
9
8
  import * as aria from './utils/aria.js';
@@ -28,142 +27,5 @@ import * as svgPaths from './utils/svg_paths.js';
28
27
  import * as toolbox from './utils/toolbox.js';
29
28
  import * as userAgent from './utils/useragent.js';
30
29
  import * as xml from './utils/xml.js';
31
- import type { WorkspaceSvg } from './workspace_svg.js';
32
30
  export { aria, arrayUtils as array, browserEvents, colour, Coordinate, deprecation, dom, extensions, idGenerator, KeyCodes, math, Metrics, object, parsing, Rect, Size, stringUtils as string, style, Svg, svgMath, svgPaths, toolbox, userAgent, xml, };
33
- /**
34
- * Return the coordinates of the top-left corner of this element relative to
35
- * its parent. Only for SVG elements and children (e.g. rect, g, path).
36
- *
37
- * @param element SVG element to find the coordinates of.
38
- * @returns Object with .x and .y properties.
39
- * @deprecated Use **Blockly.utils.svgMath.getRelativeXY** instead.
40
- */
41
- export declare function getRelativeXY(element: Element): Coordinate;
42
- /**
43
- * Return the coordinates of the top-left corner of this element relative to
44
- * the div Blockly was injected into.
45
- *
46
- * @param element SVG element to find the coordinates of. If this is not a child
47
- * of the div Blockly was injected into, the behaviour is undefined.
48
- * @returns Object with .x and .y properties.
49
- * @deprecated Use **Blockly.utils.svgMath.getInjectionDivXY** instead.
50
- */
51
- declare function getInjectionDivXY(element: Element): Coordinate;
52
- export declare const getInjectionDivXY_: typeof getInjectionDivXY;
53
- /**
54
- * Parse a string with any number of interpolation tokens (%1, %2, ...).
55
- * It will also replace string table references (e.g., %{bky_my_msg} and
56
- * %{BKY_MY_MSG} will both be replaced with the value in
57
- * Msg['MY_MSG']). Percentage sign characters '%' may be self-escaped
58
- * (e.g., '%%').
59
- *
60
- * @param message Text which might contain string table references and
61
- * interpolation tokens.
62
- * @returns Array of strings and numbers.
63
- * @deprecated Use **Blockly.utils.parsing.tokenizeInterpolation** instead.
64
- */
65
- export declare function tokenizeInterpolation(message: string): Array<string | number>;
66
- /**
67
- * Replaces string table references in a message, if the message is a string.
68
- * For example, "%{bky_my_msg}" and "%{BKY_MY_MSG}" will both be replaced with
69
- * the value in Msg['MY_MSG'].
70
- *
71
- * @param message Message, which may be a string that contains string table
72
- * references.
73
- * @returns String with message references replaced.
74
- * @deprecated Use **Blockly.utils.parsing.replaceMessageReferences** instead.
75
- */
76
- export declare function replaceMessageReferences(message: string | any): string;
77
- /**
78
- * Validates that any %{MSG_KEY} references in the message refer to keys of
79
- * the Msg string table.
80
- *
81
- * @param message Text which might contain string table references.
82
- * @returns True if all message references have matching values.
83
- * Otherwise, false.
84
- * @deprecated Use **Blockly.utils.parsing.checkMessageReferences** instead.
85
- */
86
- export declare function checkMessageReferences(message: string): boolean;
87
- /**
88
- * Check if 3D transforms are supported by adding an element
89
- * and attempting to set the property.
90
- *
91
- * @returns True if 3D transforms are supported.
92
- * @deprecated Use **Blockly.utils.svgMath.is3dSupported** instead.
93
- */
94
- export declare function is3dSupported(): boolean;
95
- /**
96
- * Get the position of the current viewport in window coordinates. This takes
97
- * scroll into account.
98
- *
99
- * @returns An object containing window width, height, and scroll position in
100
- * window coordinates.
101
- * @deprecated Use **Blockly.utils.svgMath.getViewportBBox** instead.
102
- * @internal
103
- */
104
- export declare function getViewportBBox(): Rect;
105
- /**
106
- * Removes the first occurrence of a particular value from an array.
107
- *
108
- * @param arr Array from which to remove value.
109
- * @param value Value to remove.
110
- * @returns True if an element was removed.
111
- * @deprecated Use **Blockly.array.removeElem** instead.
112
- * @internal
113
- */
114
- export declare function arrayRemove<T>(arr: Array<T>, value: T): boolean;
115
- /**
116
- * Gets the document scroll distance as a coordinate object.
117
- * Copied from Closure's goog.dom.getDocumentScroll.
118
- *
119
- * @returns Object with values 'x' and 'y'.
120
- * @deprecated Use **Blockly.utils.svgMath.getDocumentScroll** instead.
121
- */
122
- export declare function getDocumentScroll(): Coordinate;
123
- /**
124
- * Get a map of all the block's descendants mapping their type to the number of
125
- * children with that type.
126
- *
127
- * @param block The block to map.
128
- * @param opt_stripFollowing Optionally ignore all following statements (blocks
129
- * that are not inside a value or statement input of the block).
130
- * @returns Map of types to type counts for descendants of the bock.
131
- * @deprecated Use **Blockly.common.getBlockTypeCounts** instead.
132
- */
133
- export declare function getBlockTypeCounts(block: Block, opt_stripFollowing?: boolean): {
134
- [key: string]: number;
135
- };
136
- /**
137
- * Converts screen coordinates to workspace coordinates.
138
- *
139
- * @param ws The workspace to find the coordinates on.
140
- * @param screenCoordinates The screen coordinates to be converted to workspace
141
- * coordinates
142
- * @deprecated Use **Blockly.utils.svgMath.screenToWsCoordinates** instead.
143
- * @returns The workspace coordinates.
144
- */
145
- export declare function screenToWsCoordinates(ws: WorkspaceSvg, screenCoordinates: Coordinate): Coordinate;
146
- /**
147
- * Parse a block colour from a number or string, as provided in a block
148
- * definition.
149
- *
150
- * @param colour HSV hue value (0 to 360), #RRGGBB string, or a message
151
- * reference string pointing to one of those two values.
152
- * @returns An object containing the colour as a #RRGGBB string, and the hue if
153
- * the input was an HSV hue value.
154
- * @throws {Error} If the colour cannot be parsed.
155
- * @deprecated Use **Blockly.utils.parsing.parseBlockColour** instead.
156
- */
157
- export declare function parseBlockColour(colour: number | string): {
158
- hue: number | null;
159
- hex: string;
160
- };
161
- /**
162
- * Calls a function after the page has loaded, possibly immediately.
163
- *
164
- * @param fn Function to run.
165
- * @throws Error Will throw if no global document can be found (e.g., Node.js).
166
- * @deprecated No longer provided by Blockly.
167
- */
168
- export declare function runAfterPageLoad(fn: () => void): void;
169
31
  //# sourceMappingURL=utils.d.ts.map