blockly 11.0.0-beta.0 → 11.0.0-beta.10

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 (289) hide show
  1. package/blockly.min.js +852 -891
  2. package/blockly_compressed.js +794 -796
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks.js +4 -22
  5. package/blocks_compressed.js +38 -41
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +58 -10
  8. package/core/block_svg.d.ts +50 -44
  9. package/core/blockly.d.ts +22 -56
  10. package/core/bubbles/bubble.d.ts +17 -2
  11. package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
  12. package/core/bubbles/text_bubble.d.ts +1 -1
  13. package/core/bubbles/textinput_bubble.d.ts +1 -1
  14. package/core/clipboard/workspace_comment_paster.d.ts +5 -4
  15. package/core/clipboard.d.ts +0 -19
  16. package/core/comments/comment_view.d.ts +217 -0
  17. package/core/comments/rendered_workspace_comment.d.ts +90 -0
  18. package/core/comments/workspace_comment.d.ts +107 -0
  19. package/core/comments.d.ts +9 -0
  20. package/core/connection.d.ts +1 -1
  21. package/core/constants.d.ts +5 -0
  22. package/core/contextmenu.d.ts +1 -34
  23. package/core/contextmenu_items.d.ts +8 -0
  24. package/core/contextmenu_registry.d.ts +18 -3
  25. package/core/delete_area.d.ts +1 -2
  26. package/core/dragging/block_drag_strategy.d.ts +105 -0
  27. package/core/dragging/bubble_drag_strategy.d.ts +20 -0
  28. package/core/dragging/comment_drag_strategy.d.ts +21 -0
  29. package/core/dragging/dragger.d.ts +48 -0
  30. package/core/dragging.d.ts +11 -0
  31. package/core/events/events.d.ts +3 -0
  32. package/core/events/events_block_change.d.ts +15 -0
  33. package/core/events/events_click.d.ts +1 -1
  34. package/core/events/events_comment_base.d.ts +6 -1
  35. package/core/events/events_comment_change.d.ts +1 -1
  36. package/core/events/events_comment_collapse.d.ts +39 -0
  37. package/core/events/events_comment_create.d.ts +5 -1
  38. package/core/events/events_comment_delete.d.ts +5 -1
  39. package/core/events/events_comment_move.d.ts +17 -1
  40. package/core/events/utils.d.ts +3 -3
  41. package/core/field_dropdown.d.ts +1 -0
  42. package/core/field_image.d.ts +1 -1
  43. package/core/flyout_base.d.ts +17 -1
  44. package/core/flyout_button.d.ts +26 -1
  45. package/core/generator.d.ts +1 -1
  46. package/core/gesture.d.ts +29 -53
  47. package/core/grid.d.ts +29 -8
  48. package/core/icons/comment_icon.d.ts +8 -3
  49. package/core/icons/icon.d.ts +0 -6
  50. package/core/icons/icon_types.d.ts +2 -2
  51. package/core/icons/mutator_icon.d.ts +1 -16
  52. package/core/icons/warning_icon.d.ts +1 -1
  53. package/core/inputs/input.d.ts +10 -19
  54. package/core/insertion_marker_manager.d.ts +2 -0
  55. package/core/insertion_marker_previewer.d.ts +56 -0
  56. package/core/interfaces/i_comment_icon.d.ts +21 -0
  57. package/core/interfaces/i_connection_previewer.d.ts +39 -0
  58. package/core/interfaces/i_deletable.d.ts +6 -0
  59. package/core/interfaces/i_delete_area.d.ts +1 -2
  60. package/core/interfaces/i_draggable.d.ts +47 -3
  61. package/core/interfaces/i_dragger.d.ts +32 -0
  62. package/core/interfaces/i_has_bubble.d.ts +1 -1
  63. package/core/interfaces/i_parameter_model.d.ts +7 -0
  64. package/core/interfaces/i_procedure_model.d.ts +7 -0
  65. package/core/interfaces/i_selectable.d.ts +5 -3
  66. package/core/internal_constants.d.ts +0 -7
  67. package/core/keyboard_nav/ast_node.d.ts +21 -2
  68. package/core/options.d.ts +1 -0
  69. package/core/registry.d.ts +10 -4
  70. package/core/render_management.d.ts +4 -1
  71. package/core/rendered_connection.d.ts +3 -1
  72. package/core/renderers/common/constants.d.ts +6 -2
  73. package/core/renderers/common/drawer.d.ts +18 -7
  74. package/core/renderers/common/i_path_object.d.ts +6 -15
  75. package/core/renderers/common/info.d.ts +5 -2
  76. package/core/renderers/common/marker_svg.d.ts +7 -0
  77. package/core/renderers/common/path_object.d.ts +13 -0
  78. package/core/renderers/common/renderer.d.ts +3 -0
  79. package/core/renderers/measurables/connection.d.ts +1 -0
  80. package/core/renderers/measurables/icon.d.ts +0 -5
  81. package/core/renderers/zelos/drawer.d.ts +4 -0
  82. package/core/renderers/zelos/renderer.d.ts +4 -2
  83. package/core/serialization/blocks.d.ts +1 -0
  84. package/core/serialization/priorities.d.ts +2 -0
  85. package/core/serialization/procedures.d.ts +28 -26
  86. package/core/serialization/workspace_comments.d.ts +45 -0
  87. package/core/serialization.d.ts +2 -1
  88. package/core/toolbox/toolbox.d.ts +1 -2
  89. package/core/utils/dom.d.ts +0 -9
  90. package/core/utils/keycodes.d.ts +32 -32
  91. package/core/utils/size.d.ts +10 -0
  92. package/core/utils/string.d.ts +0 -10
  93. package/core/utils/toolbox.d.ts +1 -0
  94. package/core/workspace.d.ts +9 -1
  95. package/core/workspace_audio.d.ts +10 -0
  96. package/core/workspace_svg.d.ts +10 -32
  97. package/core/xml.d.ts +9 -3
  98. package/core-node.js +31 -0
  99. package/core.js +4 -26
  100. package/dart.d.ts +1 -1
  101. package/dart.js +4 -22
  102. package/dart_compressed.js +22 -72
  103. package/dart_compressed.js.map +1 -1
  104. package/generators/dart/dart_generator.d.ts +17 -17
  105. package/generators/dart/text.d.ts +0 -1
  106. package/generators/javascript/javascript_generator.d.ts +34 -35
  107. package/generators/javascript/text.d.ts +0 -1
  108. package/generators/lua/lua_generator.d.ts +10 -10
  109. package/generators/lua/text.d.ts +0 -1
  110. package/generators/php/php_generator.d.ts +36 -36
  111. package/generators/php/text.d.ts +0 -1
  112. package/generators/python/python_generator.d.ts +20 -21
  113. package/generators/python/text.d.ts +0 -1
  114. package/index.js +19 -7
  115. package/javascript.d.ts +1 -1
  116. package/javascript.js +4 -23
  117. package/javascript_compressed.js +19 -54
  118. package/javascript_compressed.js.map +1 -1
  119. package/lua.d.ts +1 -1
  120. package/lua.js +4 -22
  121. package/lua_compressed.js +24 -47
  122. package/lua_compressed.js.map +1 -1
  123. package/media/delete-icon.svg +1 -0
  124. package/media/foldout-icon.svg +1 -0
  125. package/media/resize-handle.svg +3 -0
  126. package/msg/ab.js +1 -0
  127. package/msg/ace.js +1 -0
  128. package/msg/af.js +1 -0
  129. package/msg/am.js +1 -0
  130. package/msg/ar.js +2 -1
  131. package/msg/ast.js +1 -0
  132. package/msg/az.js +1 -0
  133. package/msg/ba.js +1 -0
  134. package/msg/bcc.js +1 -0
  135. package/msg/be-tarask.js +9 -8
  136. package/msg/be.js +1 -0
  137. package/msg/bg.js +1 -0
  138. package/msg/bn.js +6 -5
  139. package/msg/br.js +1 -0
  140. package/msg/bs.js +1 -0
  141. package/msg/ca.js +1 -0
  142. package/msg/cdo.js +1 -0
  143. package/msg/ce.d.ts +8 -0
  144. package/msg/ce.js +1 -0
  145. package/msg/cs.js +1 -0
  146. package/msg/da.js +5 -4
  147. package/msg/de.js +1 -0
  148. package/msg/diq.js +1 -0
  149. package/msg/dtp.d.ts +8 -0
  150. package/msg/dtp.js +1 -0
  151. package/msg/dty.js +1 -0
  152. package/msg/ee.js +1 -0
  153. package/msg/el.js +2 -1
  154. package/msg/en-gb.js +1 -0
  155. package/msg/en.js +1 -0
  156. package/msg/eo.js +1 -0
  157. package/msg/es.js +1 -0
  158. package/msg/et.js +1 -0
  159. package/msg/eu.js +1 -0
  160. package/msg/fa.js +1 -0
  161. package/msg/fi.js +1 -0
  162. package/msg/fo.js +1 -0
  163. package/msg/fr.js +1 -0
  164. package/msg/frr.js +1 -0
  165. package/msg/gl.js +1 -0
  166. package/msg/gn.js +1 -0
  167. package/msg/gor.js +1 -0
  168. package/msg/ha.js +1 -0
  169. package/msg/hak.js +1 -0
  170. package/msg/he.js +2 -1
  171. package/msg/hi.js +1 -0
  172. package/msg/hr.js +1 -0
  173. package/msg/hrx.js +1 -0
  174. package/msg/hsb.d.ts +8 -0
  175. package/msg/hsb.js +1 -0
  176. package/msg/hu.js +1 -0
  177. package/msg/hy.js +1 -0
  178. package/msg/ia.js +1 -0
  179. package/msg/id.js +7 -6
  180. package/msg/ig.js +1 -0
  181. package/msg/inh.js +4 -3
  182. package/msg/is.js +1 -0
  183. package/msg/it.js +1 -0
  184. package/msg/ja.js +2 -1
  185. package/msg/ka.js +1 -0
  186. package/msg/kab.js +1 -0
  187. package/msg/kbd-cyrl.js +1 -0
  188. package/msg/km.js +1 -0
  189. package/msg/kn.js +1 -0
  190. package/msg/ko.js +1 -0
  191. package/msg/ksh.js +1 -0
  192. package/msg/ku-latn.js +1 -0
  193. package/msg/ky.js +1 -0
  194. package/msg/la.js +1 -0
  195. package/msg/lb.js +1 -0
  196. package/msg/lki.js +1 -0
  197. package/msg/lo.js +1 -0
  198. package/msg/lrc.js +1 -0
  199. package/msg/lt.js +1 -0
  200. package/msg/lv.js +1 -0
  201. package/msg/mg.js +1 -0
  202. package/msg/mk.js +1 -0
  203. package/msg/ml.js +1 -0
  204. package/msg/mnw.js +1 -0
  205. package/msg/ms.js +1 -0
  206. package/msg/my.js +1 -0
  207. package/msg/mzn.js +1 -0
  208. package/msg/nb.js +1 -0
  209. package/msg/ne.js +1 -0
  210. package/msg/nl.js +4 -3
  211. package/msg/oc.js +1 -0
  212. package/msg/olo.js +1 -0
  213. package/msg/pa.js +1 -0
  214. package/msg/pl.js +1 -0
  215. package/msg/pms.js +1 -0
  216. package/msg/ps.js +1 -0
  217. package/msg/pt-br.js +1 -0
  218. package/msg/pt.js +2 -1
  219. package/msg/ro.js +1 -0
  220. package/msg/ru.js +1 -0
  221. package/msg/sc.js +1 -0
  222. package/msg/sco.js +1 -0
  223. package/msg/sd.js +1 -0
  224. package/msg/shn.js +1 -0
  225. package/msg/si.js +1 -0
  226. package/msg/sk.js +1 -0
  227. package/msg/skr-arab.js +1 -0
  228. package/msg/sl.js +1 -0
  229. package/msg/smn.js +1 -0
  230. package/msg/sq.js +1 -0
  231. package/msg/sr-latn.js +1 -0
  232. package/msg/sr.js +1 -0
  233. package/msg/sv.js +1 -0
  234. package/msg/sw.js +1 -0
  235. package/msg/ta.js +3 -2
  236. package/msg/tcy.js +1 -0
  237. package/msg/tdd.d.ts +8 -0
  238. package/msg/tdd.js +1 -0
  239. package/msg/te.js +1 -0
  240. package/msg/th.js +1 -0
  241. package/msg/ti.js +1 -0
  242. package/msg/tl.js +3 -2
  243. package/msg/tlh.js +1 -0
  244. package/msg/tr.js +1 -0
  245. package/msg/ug-arab.js +1 -0
  246. package/msg/uk.js +1 -0
  247. package/msg/ur.js +3 -2
  248. package/msg/uz.js +1 -0
  249. package/msg/vi.js +1 -0
  250. package/msg/xmf.js +1 -0
  251. package/msg/yo.js +1 -0
  252. package/msg/zgh.js +1 -0
  253. package/msg/zh-hans.js +1 -0
  254. package/msg/zh-hant.js +15 -14
  255. package/package.json +49 -15
  256. package/php.d.ts +1 -1
  257. package/php.js +4 -22
  258. package/php_compressed.js +13 -46
  259. package/php_compressed.js.map +1 -1
  260. package/python.d.ts +1 -1
  261. package/python.js +4 -23
  262. package/python_compressed.js +21 -40
  263. package/python_compressed.js.map +1 -1
  264. package/blockly.js +0 -22
  265. package/browser.js +0 -30
  266. package/core/block_dragger.d.ts +0 -162
  267. package/core/bubble_dragger.d.ts +0 -77
  268. package/core/field_angle.d.ts +0 -208
  269. package/core/field_colour.d.ts +0 -243
  270. package/core/field_multilineinput.d.ts +0 -182
  271. package/core/interfaces/i_block_dragger.d.ts +0 -47
  272. package/core/renderers/minimalist/constants.d.ts +0 -21
  273. package/core/renderers/minimalist/drawer.d.ts +0 -26
  274. package/core/renderers/minimalist/info.d.ts +0 -35
  275. package/core/renderers/minimalist/minimalist.d.ts +0 -12
  276. package/core/renderers/minimalist/renderer.d.ts +0 -48
  277. package/core/workspace_comment.d.ts +0 -190
  278. package/core/workspace_comment_svg.d.ts +0 -361
  279. package/core-browser.js +0 -26
  280. package/generators/dart/colour.d.ts +0 -16
  281. package/generators/javascript/colour.d.ts +0 -16
  282. package/generators/lua/colour.d.ts +0 -16
  283. package/generators/php/colour.d.ts +0 -16
  284. package/generators/python/colour.d.ts +0 -16
  285. package/msg/constants.d.ts +0 -14
  286. package/msg/qqq.d.ts +0 -14
  287. package/msg/synonyms.d.ts +0 -14
  288. package/msg/yue.js +0 -441
  289. package/node.js +0 -21
package/core/gesture.d.ts CHANGED
@@ -11,15 +11,15 @@
11
11
  */
12
12
  import './events/events_click.js';
13
13
  import type { BlockSvg } from './block_svg.js';
14
- import { BubbleDragger } from './bubble_dragger.js';
15
14
  import type { Field } from './field.js';
16
- import type { IBlockDragger } from './interfaces/i_block_dragger.js';
17
15
  import type { IBubble } from './interfaces/i_bubble.js';
18
16
  import type { IFlyout } from './interfaces/i_flyout.js';
19
17
  import { Coordinate } from './utils/coordinate.js';
20
18
  import { WorkspaceDragger } from './workspace_dragger.js';
21
19
  import type { WorkspaceSvg } from './workspace_svg.js';
22
20
  import type { IIcon } from './interfaces/i_icon.js';
21
+ import { IDragger } from './interfaces/i_dragger.js';
22
+ import { RenderedWorkspaceComment } from './comments.js';
23
23
  /**
24
24
  * Class for one gesture.
25
25
  */
@@ -52,6 +52,11 @@ export declare class Gesture {
52
52
  * block.
53
53
  */
54
54
  private startBlock;
55
+ /**
56
+ * The comment that the gesture started on, or null if it did not start on a
57
+ * comment.
58
+ */
59
+ private startComment;
55
60
  /**
56
61
  * The block that this gesture targets. If the gesture started on a
57
62
  * shadow block, this is the first non-shadow parent of the block. If the
@@ -77,15 +82,14 @@ export declare class Gesture {
77
82
  * Ex: [[node, name, func], [node, name, func]].
78
83
  */
79
84
  private boundEvents;
80
- /** The object tracking a bubble drag, or null if none is in progress. */
81
- private bubbleDragger;
82
- /** The object tracking a block drag, or null if none is in progress. */
83
- private blockDragger;
85
+ private dragger;
84
86
  /**
85
87
  * The object tracking a workspace or flyout workspace drag, or null if none
86
88
  * is in progress.
87
89
  */
88
90
  private workspaceDragger;
91
+ /** Whether the gesture is dragging or not. */
92
+ private dragging;
89
93
  /** The flyout a gesture started in, if any. */
90
94
  private flyout;
91
95
  /** Boolean for sanity-checking that some code is only called once. */
@@ -94,7 +98,6 @@ export declare class Gesture {
94
98
  private gestureHasStarted;
95
99
  /** Boolean used internally to break a cycle in disposal. */
96
100
  protected isEnding_: boolean;
97
- private healStack;
98
101
  /** The event that most recently updated this gesture. */
99
102
  private mostRecentEvent;
100
103
  /** Boolean for whether or not this gesture is a multi-touch gesture. */
@@ -158,30 +161,6 @@ export declare class Gesture {
158
161
  * @returns True if a block is being dragged from the flyout.
159
162
  */
160
163
  private updateIsDraggingFromFlyout;
161
- /**
162
- * Update this gesture to record whether a bubble is being dragged.
163
- * This function should be called on a pointermove event the first time
164
- * the drag radius is exceeded. It should be called no more than once per
165
- * gesture. If a bubble should be dragged this function creates the necessary
166
- * BubbleDragger and starts the drag.
167
- *
168
- * @returns True if a bubble is being dragged.
169
- */
170
- private updateIsDraggingBubble;
171
- /**
172
- * Check whether to start a block drag. If a block should be dragged, either
173
- * from the flyout or in the workspace, create the necessary BlockDragger and
174
- * start the drag.
175
- *
176
- * This function should be called on a pointermove event the first time
177
- * the drag radius is exceeded. It should be called no more than once per
178
- * gesture. If a block should be dragged, either from the flyout or in the
179
- * workspace, this function creates the necessary BlockDragger and starts the
180
- * drag.
181
- *
182
- * @returns True if a block is being dragged.
183
- */
184
- private updateIsDraggingBlock;
185
164
  /**
186
165
  * Check whether to start a workspace drag. If a workspace is being dragged,
187
166
  * create the necessary WorkspaceDragger and start the drag.
@@ -199,10 +178,7 @@ export declare class Gesture {
199
178
  * gesture.
200
179
  */
201
180
  private updateIsDragging;
202
- /** Create a block dragger and start dragging the selected block. */
203
- private startDraggingBlock;
204
- /** Create a bubble dragger and start dragging the selected bubble. */
205
- private startDraggingBubble;
181
+ private createDragger;
206
182
  /**
207
183
  * Start a gesture: update the workspace to indicate that a gesture is in
208
184
  * progress and bind pointermove and pointerup handlers.
@@ -335,8 +311,14 @@ export declare class Gesture {
335
311
  * @internal
336
312
  */
337
313
  handleBubbleStart(e: PointerEvent, bubble: IBubble): void;
338
- /** Execute a bubble click. */
339
- private doBubbleClick;
314
+ /**
315
+ * Handle a pointerdown event on a workspace comment.
316
+ *
317
+ * @param e A pointerdown event.
318
+ * @param comment The comment the event hit.
319
+ * @internal
320
+ */
321
+ handleCommentStart(e: PointerEvent, comment: RenderedWorkspaceComment): void;
340
322
  /** Execute a field click. */
341
323
  private doFieldClick;
342
324
  /** Execute an icon click. */
@@ -376,6 +358,13 @@ export declare class Gesture {
376
358
  * @internal
377
359
  */
378
360
  setStartBubble(bubble: IBubble): void;
361
+ /**
362
+ * Record the comment that a gesture started on
363
+ *
364
+ * @param comment The comment the gesture started on.
365
+ * @internal
366
+ */
367
+ setStartComment(comment: RenderedWorkspaceComment): void;
379
368
  /**
380
369
  * Record the block that a gesture started on, and set the target block
381
370
  * appropriately.
@@ -411,6 +400,7 @@ export declare class Gesture {
411
400
  * @returns Whether this gesture was a click on a bubble.
412
401
  */
413
402
  private isBubbleClick;
403
+ private isCommentClick;
414
404
  /**
415
405
  * Whether this gesture is a click on a block. This should only be called
416
406
  * when ending a gesture (pointerup).
@@ -434,6 +424,8 @@ export declare class Gesture {
434
424
  * @returns Whether this gesture was a click on a workspace.
435
425
  */
436
426
  private isWorkspaceClick;
427
+ /** Returns the current dragger if the gesture is a drag. */
428
+ getCurrentDragger(): WorkspaceDragger | IDragger | null;
437
429
  /**
438
430
  * Whether this gesture is a drag of either a workspace or block.
439
431
  * This function is called externally to block actions that cannot be taken
@@ -452,22 +444,6 @@ export declare class Gesture {
452
444
  * @internal
453
445
  */
454
446
  hasStarted(): boolean;
455
- /**
456
- * Get a list of the insertion markers that currently exist. Block drags have
457
- * 0, 1, or 2 insertion markers.
458
- *
459
- * @returns A possibly empty list of insertion marker blocks.
460
- * @internal
461
- */
462
- getInsertionMarkers(): BlockSvg[];
463
- /**
464
- * Gets the current dragger if an item is being dragged. Null if nothing is
465
- * being dragged.
466
- *
467
- * @returns The dragger that is currently in use or null if no drag is in
468
- * progress.
469
- */
470
- getCurrentDragger(): WorkspaceDragger | BubbleDragger | IBlockDragger | null;
471
447
  /**
472
448
  * Is a drag or other gesture currently in progress on any workspace?
473
449
  *
package/core/grid.d.ts CHANGED
@@ -9,11 +9,12 @@ import { GridOptions } from './options.js';
9
9
  */
10
10
  export declare class Grid {
11
11
  private pattern;
12
- private readonly spacing;
13
- private readonly length;
12
+ private spacing;
13
+ private length;
14
+ private scale;
14
15
  private readonly line1;
15
16
  private readonly line2;
16
- private readonly snapToGrid;
17
+ private snapToGrid;
17
18
  /**
18
19
  * @param pattern The grid's SVG pattern, created during injection.
19
20
  * @param options A dictionary of normalized options for the grid.
@@ -22,19 +23,39 @@ export declare class Grid {
22
23
  */
23
24
  constructor(pattern: SVGElement, options: GridOptions);
24
25
  /**
25
- * Whether blocks should snap to the grid, based on the initial configuration.
26
+ * Sets the spacing between the centers of the grid lines.
26
27
  *
27
- * @returns True if blocks should snap, false otherwise.
28
- * @internal
28
+ * This does not trigger snapping to the newly spaced grid. If you want to
29
+ * snap blocks to the grid programmatically that needs to be triggered
30
+ * on individual top-level blocks. The next time a block is dragged and
31
+ * dropped it will snap to the grid if snapping to the grid is enabled.
29
32
  */
30
- shouldSnap(): boolean;
33
+ setSpacing(spacing: number): void;
31
34
  /**
32
35
  * Get the spacing of the grid points (in px).
33
36
  *
34
37
  * @returns The spacing of the grid points.
35
- * @internal
36
38
  */
37
39
  getSpacing(): number;
40
+ /** Sets the length of the grid lines. */
41
+ setLength(length: number): void;
42
+ /** Get the length of the grid lines (in px). */
43
+ getLength(): number;
44
+ /**
45
+ * Sets whether blocks should snap to the grid or not.
46
+ *
47
+ * Setting this to true does not trigger snapping. If you want to snap blocks
48
+ * to the grid programmatically that needs to be triggered on individual
49
+ * top-level blocks. The next time a block is dragged and dropped it will
50
+ * snap to the grid.
51
+ */
52
+ setSnapToGrid(snap: boolean): void;
53
+ /**
54
+ * Whether blocks should snap to the grid.
55
+ *
56
+ * @returns True if blocks should snap, false otherwise.
57
+ */
58
+ shouldSnap(): boolean;
38
59
  /**
39
60
  * Get the ID of the pattern element, which should be randomized to avoid
40
61
  * conflicts with other Blockly instances on the page.
@@ -16,7 +16,7 @@ import { Size } from '../utils/size.js';
16
16
  export declare class CommentIcon extends Icon implements IHasBubble, ISerializable {
17
17
  protected readonly sourceBlock: Block;
18
18
  /** The type string used to identify this icon. */
19
- static readonly TYPE: IconType<CommentIcon>;
19
+ static readonly TYPE: IconType<import("../interfaces/i_comment_icon.js").ICommentIcon>;
20
20
  /**
21
21
  * The weight this icon has relative to other icons. Icons with more positive
22
22
  * weight values are rendered farther toward the end of the block.
@@ -49,7 +49,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
49
49
  * Updates the state of the bubble (editable / noneditable) to reflect the
50
50
  * state of the bubble if the bubble is currently shown.
51
51
  */
52
- updateEditable(): void;
52
+ updateEditable(): Promise<void>;
53
53
  onLocationChange(blockOrigin: Coordinate): void;
54
54
  /** Sets the text of this comment. Updates any bubbles if they are visible. */
55
55
  setText(text: string): void;
@@ -82,7 +82,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
82
82
  */
83
83
  onSizeChange(): void;
84
84
  bubbleIsVisible(): boolean;
85
- setBubbleVisible(visible: boolean): void;
85
+ setBubbleVisible(visible: boolean): Promise<void>;
86
86
  /**
87
87
  * Shows the editable text bubble for this comment, and adds change listeners
88
88
  * to update the state of this icon in response to changes in the bubble.
@@ -103,10 +103,15 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
103
103
  */
104
104
  private getBubbleOwnerRect;
105
105
  }
106
+ /** The save state format for a comment icon. */
106
107
  export interface CommentState {
108
+ /** The text of the comment. */
107
109
  text?: string;
110
+ /** True if the comment is open, false otherwise. */
108
111
  pinned?: boolean;
112
+ /** The height of the comment bubble. */
109
113
  height?: number;
114
+ /** The width of the comment bubble. */
110
115
  width?: number;
111
116
  }
112
117
  //# sourceMappingURL=comment_icon.d.ts.map
@@ -59,11 +59,5 @@ export declare abstract class Icon implements IIcon {
59
59
  * @returns Whether the icon should be clickable while the block is in a flyout.
60
60
  */
61
61
  isClickableInFlyout(autoClosingFlyout: boolean): boolean;
62
- /**
63
- * Sets the visibility of the icon's bubble if one exists.
64
- *
65
- * @deprecated Use `setBubbleVisible` instead. To be removed in v11.
66
- */
67
- setVisible(visibility: boolean): void;
68
62
  }
69
63
  //# sourceMappingURL=icon.d.ts.map
@@ -3,8 +3,8 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { ICommentIcon } from '../interfaces/i_comment_icon.js';
6
7
  import { IIcon } from '../interfaces/i_icon.js';
7
- import { CommentIcon } from './comment_icon.js';
8
8
  import { MutatorIcon } from './mutator_icon.js';
9
9
  import { WarningIcon } from './warning_icon.js';
10
10
  /**
@@ -20,6 +20,6 @@ export declare class IconType<_T extends IIcon> {
20
20
  equals(type: IconType<IIcon>): boolean;
21
21
  static MUTATOR: IconType<MutatorIcon>;
22
22
  static WARNING: IconType<WarningIcon>;
23
- static COMMENT: IconType<CommentIcon>;
23
+ static COMMENT: IconType<ICommentIcon>;
24
24
  }
25
25
  //# sourceMappingURL=icon_types.d.ts.map
@@ -4,9 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Abstract } from '../events/events_abstract.js';
7
- import type { Block } from '../block.js';
8
7
  import type { BlockSvg } from '../block_svg.js';
9
- import type { Connection } from '../connection.js';
10
8
  import { Coordinate } from '../utils/coordinate.js';
11
9
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
12
10
  import { Icon } from './icon.js';
@@ -55,7 +53,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
55
53
  onClick(): void;
56
54
  isClickableInFlyout(): boolean;
57
55
  bubbleIsVisible(): boolean;
58
- setBubbleVisible(visible: boolean): void;
56
+ setBubbleVisible(visible: boolean): Promise<void>;
59
57
  /** @returns the configuration the mini workspace should have. */
60
58
  private getMiniWorkspaceConfig;
61
59
  /**
@@ -91,18 +89,5 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
91
89
  * currently open.
92
90
  */
93
91
  getWorkspace(): WorkspaceSvg | undefined;
94
- /**
95
- * Reconnects the given connection to the mutated input on the given block.
96
- *
97
- * @deprecated Use connection.reconnect instead. To be removed in v11.
98
- */
99
- static reconnect(connectionChild: Connection | null, block: Block, inputName: string): boolean;
100
- /**
101
- * Returns the parent workspace of a workspace that is inside a mini workspace
102
- * bubble, taking into account whether the workspace is a flyout.
103
- *
104
- * @deprecated Use workspace.getRootWorkspace. To be removed in v11.
105
- */
106
- static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg | null;
107
92
  }
108
93
  //# sourceMappingURL=mutator_icon.d.ts.map
@@ -59,7 +59,7 @@ export declare class WarningIcon extends Icon implements IHasBubble {
59
59
  onClick(): void;
60
60
  isClickableInFlyout(): boolean;
61
61
  bubbleIsVisible(): boolean;
62
- setBubbleVisible(visible: boolean): void;
62
+ setBubbleVisible(visible: boolean): Promise<void>;
63
63
  /**
64
64
  * @returns the location the bubble should be anchored to.
65
65
  * I.E. the middle of this icon.
@@ -15,13 +15,14 @@ import type { Connection } from '../connection.js';
15
15
  import type { ConnectionType } from '../connection_type.js';
16
16
  import type { Field } from '../field.js';
17
17
  import { inputTypes } from './input_types.js';
18
+ import { Align } from './align.js';
18
19
  /** Class for an input with optional fields. */
19
20
  export declare class Input {
20
21
  name: string;
21
22
  private sourceBlock;
22
23
  fieldRow: Field[];
23
24
  /** Alignment of input's fields (left, right or centre). */
24
- align: Input.Align;
25
+ align: Align;
25
26
  /** Is the input visible? */
26
27
  private visible;
27
28
  readonly type: inputTypes;
@@ -121,6 +122,14 @@ export declare class Input {
121
122
  getShadowDom(): Element | null;
122
123
  /** Initialize the fields on this input. */
123
124
  init(): void;
125
+ /**
126
+ * Initializes the fields on this input for a headless block.
127
+ *
128
+ * @internal
129
+ */
130
+ initModel(): void;
131
+ /** Initializes the given field. */
132
+ private initField;
124
133
  /**
125
134
  * Sever all links to this input.
126
135
  */
@@ -135,22 +144,4 @@ export declare class Input {
135
144
  */
136
145
  protected makeConnection(type: ConnectionType): Connection;
137
146
  }
138
- export declare namespace Input {
139
- /**
140
- * Enum for alignment of inputs.
141
- *
142
- * @deprecated Use Blockly.inputs.Align. To be removed in v11.
143
- */
144
- enum Align {
145
- LEFT = -1,
146
- CENTRE = 0,
147
- RIGHT = 1
148
- }
149
- }
150
- /** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
151
- /** @suppress {deprecated} */
152
- export type Align = Input.Align;
153
- /** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
154
- /** @suppress {deprecated} */
155
- export declare const Align: typeof Input.Align;
156
147
  //# sourceMappingURL=input.d.ts.map
@@ -10,6 +10,8 @@ import type { Coordinate } from './utils/coordinate.js';
10
10
  * Class that controls updates to connections during drags. It is primarily
11
11
  * responsible for finding the closest eligible connection and highlighting or
12
12
  * unhighlighting it as needed during a drag.
13
+ *
14
+ * @deprecated v10 - Use an IConnectionPreviewer instead.
13
15
  */
14
16
  export declare class InsertionMarkerManager {
15
17
  /**
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BlockSvg } from './block_svg.js';
7
+ import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
8
+ import { RenderedConnection } from './rendered_connection.js';
9
+ export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
10
+ private readonly workspace;
11
+ private fadedBlock;
12
+ private markerConn;
13
+ private draggedConn;
14
+ private staticConn;
15
+ constructor(draggedBlock: BlockSvg);
16
+ /**
17
+ * Display a connection preview where the draggedCon connects to the
18
+ * staticCon, replacing the replacedBlock (currently connected to the
19
+ * staticCon).
20
+ *
21
+ * @param draggedConn The connection on the block stack being dragged.
22
+ * @param staticConn The connection not being dragged that we are
23
+ * connecting to.
24
+ * @param replacedBlock The block currently connected to the staticCon that
25
+ * is being replaced.
26
+ */
27
+ previewReplacement(draggedConn: RenderedConnection, staticConn: RenderedConnection, replacedBlock: BlockSvg): void;
28
+ /**
29
+ * Display a connection preview where the draggedCon connects to the
30
+ * staticCon, and no block is being relaced.
31
+ *
32
+ * @param draggedConn The connection on the block stack being dragged.
33
+ * @param staticConn The connection not being dragged that we are
34
+ * connecting to.
35
+ */
36
+ previewConnection(draggedConn: RenderedConnection, staticConn: RenderedConnection): void;
37
+ private shouldUseMarkerPreview;
38
+ private previewMarker;
39
+ private createInsertionMarker;
40
+ /**
41
+ * Gets the connection on the marker block that matches the original
42
+ * connection on the original block.
43
+ *
44
+ * @param orig The original block.
45
+ * @param marker The marker block (where we want to find the matching
46
+ * connection).
47
+ * @param origConn The original connection.
48
+ */
49
+ private getMatchingConnection;
50
+ /** Hide any previews that are currently displayed. */
51
+ hidePreview(): void;
52
+ private hideInsertionMarker;
53
+ /** Dispose of any references held by this connection previewer. */
54
+ dispose(): void;
55
+ }
56
+ //# sourceMappingURL=insertion_marker_previewer.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CommentState } from '../icons/comment_icon.js';
7
+ import { IIcon } from './i_icon.js';
8
+ import { Size } from '../utils/size.js';
9
+ import { IHasBubble } from './i_has_bubble.js';
10
+ import { ISerializable } from './i_serializable.js';
11
+ export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
12
+ setText(text: string): void;
13
+ getText(): string;
14
+ setBubbleSize(size: Size): void;
15
+ getBubbleSize(): Size;
16
+ saveState(): CommentState;
17
+ loadState(state: CommentState): void;
18
+ }
19
+ /** Checks whether the given object is an ICommentIcon. */
20
+ export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
21
+ //# sourceMappingURL=i_comment_icon.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../block_svg';
7
+ import type { RenderedConnection } from '../rendered_connection';
8
+ /**
9
+ * Displays visual "previews" of where a block will be connected if it is
10
+ * dropped.
11
+ */
12
+ export interface IConnectionPreviewer {
13
+ /**
14
+ * Display a connection preview where the draggedCon connects to the
15
+ * staticCon, replacing the replacedBlock (currently connected to the
16
+ * staticCon).
17
+ *
18
+ * @param draggedCon The connection on the block stack being dragged.
19
+ * @param staticCon The connection not being dragged that we are
20
+ * connecting to.
21
+ * @param replacedBlock The block currently connected to the staticCon that
22
+ * is being replaced.
23
+ */
24
+ previewReplacement(draggedConn: RenderedConnection, staticConn: RenderedConnection, replacedBlock: BlockSvg): void;
25
+ /**
26
+ * Display a connection preview where the draggedCon connects to the
27
+ * staticCon, and no block is being relaced.
28
+ *
29
+ * @param draggedCon The connection on the block stack being dragged.
30
+ * @param staticCon The connection not being dragged that we are
31
+ * connecting to.
32
+ */
33
+ previewConnection(draggedConn: RenderedConnection, staticConn: RenderedConnection): void;
34
+ /** Hide any previews that are currently displayed. */
35
+ hidePreview(): void;
36
+ /** Dispose of any references held by this connection previewer. */
37
+ dispose(): void;
38
+ }
39
+ //# sourceMappingURL=i_connection_previewer.d.ts.map
@@ -13,5 +13,11 @@ export interface IDeletable {
13
13
  * @returns True if deletable.
14
14
  */
15
15
  isDeletable(): boolean;
16
+ /** Disposes of this object, cleaning up any references or DOM elements. */
17
+ dispose(): void;
18
+ /** Visually indicates that the object is pending deletion. */
19
+ setDeleteStyle(wouldDelete: boolean): void;
16
20
  }
21
+ /** Returns whether the given object is an IDeletable. */
22
+ export declare function isDeletable(obj: any): obj is IDeletable;
17
23
  //# sourceMappingURL=i_deletable.d.ts.map
@@ -17,10 +17,9 @@ export interface IDeleteArea extends IDragTarget {
17
17
  * before onDragEnter/onDragOver/onDragExit.
18
18
  *
19
19
  * @param element The block or bubble currently being dragged.
20
- * @param couldConnect Whether the element could could connect to another.
21
20
  * @returns Whether the element provided would be deleted if dropped on this
22
21
  * area.
23
22
  */
24
- wouldDelete(element: IDraggable, couldConnect: boolean): boolean;
23
+ wouldDelete(element: IDraggable): boolean;
25
24
  }
26
25
  //# sourceMappingURL=i_delete_area.d.ts.map
@@ -3,10 +3,54 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { IDeletable } from './i_deletable.js';
6
+ import { Coordinate } from '../utils/coordinate';
7
7
  /**
8
- * The interface for an object that can be dragged.
8
+ * Represents an object that can be dragged.
9
9
  */
10
- export interface IDraggable extends IDeletable {
10
+ export interface IDraggable extends IDragStrategy {
11
+ /**
12
+ * Returns the current location of the draggable in workspace
13
+ * coordinates.
14
+ *
15
+ * @returns Coordinate of current location on workspace.
16
+ */
17
+ getRelativeToSurfaceXY(): Coordinate;
11
18
  }
19
+ export interface IDragStrategy {
20
+ /** Returns true iff the element is currently movable. */
21
+ isMovable(): boolean;
22
+ /**
23
+ * Handles any drag startup (e.g moving elements to the front of the
24
+ * workspace).
25
+ *
26
+ * @param e PointerEvent that started the drag; can be used to
27
+ * check modifier keys, etc. May be missing when dragging is
28
+ * triggered programatically rather than by user.
29
+ */
30
+ startDrag(e?: PointerEvent): void;
31
+ /**
32
+ * Handles moving elements to the new location, and updating any
33
+ * visuals based on that (e.g connection previews for blocks).
34
+ *
35
+ * @param newLoc Workspace coordinate to which the draggable has
36
+ * been dragged.
37
+ * @param e PointerEvent that continued the drag. Can be
38
+ * used to check modifier keys, etc.
39
+ */
40
+ drag(newLoc: Coordinate, e?: PointerEvent): void;
41
+ /**
42
+ * Handles any drag cleanup, including e.g. connecting or deleting
43
+ * blocks.
44
+ *
45
+ * @param newLoc Workspace coordinate at which the drag finished.
46
+ * been dragged.
47
+ * @param e PointerEvent that finished the drag. Can be
48
+ * used to check modifier keys, etc.
49
+ */
50
+ endDrag(e?: PointerEvent): void;
51
+ /** Moves the draggable back to where it was at the start of the drag. */
52
+ revertDrag(): void;
53
+ }
54
+ /** Returns whether the given object is an IDraggable or not. */
55
+ export declare function isDraggable(obj: any): obj is IDraggable;
12
56
  //# sourceMappingURL=i_draggable.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Coordinate } from '../utils/coordinate';
7
+ export interface IDragger {
8
+ /**
9
+ * Handles any drag startup.
10
+ *
11
+ * @param e PointerEvent that started the drag.
12
+ */
13
+ onDragStart(e: PointerEvent): void;
14
+ /**
15
+ * Handles dragging, including calculating where the element should
16
+ * actually be moved to.
17
+ *
18
+ * @param e PointerEvent that continued the drag.
19
+ * @param totalDelta The total distance, in pixels, that the mouse
20
+ * has moved since the start of the drag.
21
+ */
22
+ onDrag(e: PointerEvent, totalDelta: Coordinate): void;
23
+ /**
24
+ * Handles any drag cleanup.
25
+ *
26
+ * @param e PointerEvent that finished the drag.
27
+ * @param totalDelta The total distance, in pixels, that the mouse
28
+ * has moved since the start of the drag.
29
+ */
30
+ onDragEnd(e: PointerEvent, totalDelta: Coordinate): void;
31
+ }
32
+ //# sourceMappingURL=i_dragger.d.ts.map
@@ -7,7 +7,7 @@ export interface IHasBubble {
7
7
  /** @returns True if the bubble is currently open, false otherwise. */
8
8
  bubbleIsVisible(): boolean;
9
9
  /** Sets whether the bubble is open or not. */
10
- setBubbleVisible(visible: boolean): void;
10
+ setBubbleVisible(visible: boolean): Promise<void>;
11
11
  }
12
12
  /** Type guard that checks whether the given object is a IHasBubble. */
13
13
  export declare function hasBubble(obj: any): obj is IHasBubble;