blockly 10.3.0-beta.0 → 11.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 (221) hide show
  1. package/README.md +48 -34
  2. package/blockly.min.js +270 -258
  3. package/blockly_compressed.js +232 -224
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +2 -0
  7. package/core/block_dragger.d.ts +7 -3
  8. package/core/block_svg.d.ts +11 -13
  9. package/core/events/events_block_field_intermediate_change.d.ts +6 -0
  10. package/core/field.d.ts +18 -0
  11. package/core/field_input.d.ts +6 -1
  12. package/core/flyout_base.d.ts +9 -1
  13. package/core/gesture.d.ts +2 -2
  14. package/core/icons/comment_icon.d.ts +1 -0
  15. package/core/icons/icon.d.ts +19 -0
  16. package/core/icons/mutator_icon.d.ts +1 -0
  17. package/core/icons/warning_icon.d.ts +1 -0
  18. package/core/interfaces/i_icon.d.ts +8 -0
  19. package/core/interfaces/i_rendered_element.d.ts +19 -0
  20. package/core/layer_manager.d.ts +74 -0
  21. package/core/layers.d.ts +18 -0
  22. package/core/rendered_connection.d.ts +0 -6
  23. package/core/serialization/blocks.d.ts +2 -1
  24. package/core/workspace_svg.d.ts +14 -1
  25. package/dart.d.ts +1 -22
  26. package/dart_compressed.js +14 -11
  27. package/dart_compressed.js.map +1 -1
  28. package/generators/dart/colour.d.ts +16 -0
  29. package/generators/dart/dart_generator.d.ts +100 -0
  30. package/generators/dart/lists.d.ts +24 -0
  31. package/generators/dart/logic.d.ts +20 -0
  32. package/generators/dart/loops.d.ts +14 -0
  33. package/generators/dart/math.d.ts +26 -0
  34. package/generators/dart/procedures.d.ts +17 -0
  35. package/generators/dart/text.d.ts +29 -0
  36. package/generators/dart/variables.d.ts +14 -0
  37. package/generators/dart/variables_dynamic.d.ts +10 -0
  38. package/generators/dart.d.ts +18 -0
  39. package/generators/javascript/colour.d.ts +16 -0
  40. package/generators/javascript/javascript_generator.d.ts +120 -0
  41. package/generators/javascript/lists.d.ts +24 -0
  42. package/generators/javascript/logic.d.ts +20 -0
  43. package/generators/javascript/loops.d.ts +14 -0
  44. package/generators/javascript/math.d.ts +26 -0
  45. package/generators/javascript/procedures.d.ts +17 -0
  46. package/generators/javascript/text.d.ts +29 -0
  47. package/generators/javascript/variables.d.ts +14 -0
  48. package/generators/javascript/variables_dynamic.d.ts +10 -0
  49. package/generators/javascript.d.ts +18 -0
  50. package/generators/lua/colour.d.ts +16 -0
  51. package/generators/lua/lists.d.ts +24 -0
  52. package/generators/lua/logic.d.ts +20 -0
  53. package/generators/lua/loops.d.ts +14 -0
  54. package/generators/lua/lua_generator.d.ts +85 -0
  55. package/generators/lua/math.d.ts +26 -0
  56. package/generators/lua/procedures.d.ts +17 -0
  57. package/generators/lua/text.d.ts +29 -0
  58. package/generators/lua/variables.d.ts +14 -0
  59. package/generators/lua/variables_dynamic.d.ts +10 -0
  60. package/generators/lua.d.ts +16 -0
  61. package/generators/php/colour.d.ts +16 -0
  62. package/generators/php/lists.d.ts +21 -0
  63. package/generators/php/logic.d.ts +20 -0
  64. package/generators/php/loops.d.ts +14 -0
  65. package/generators/php/math.d.ts +26 -0
  66. package/generators/php/php_generator.d.ts +118 -0
  67. package/generators/php/procedures.d.ts +14 -0
  68. package/generators/php/text.d.ts +29 -0
  69. package/generators/php/variables.d.ts +14 -0
  70. package/generators/php/variables_dynamic.d.ts +10 -0
  71. package/generators/php.d.ts +18 -0
  72. package/generators/python/colour.d.ts +16 -0
  73. package/generators/python/lists.d.ts +21 -0
  74. package/generators/python/logic.d.ts +20 -0
  75. package/generators/python/loops.d.ts +14 -0
  76. package/generators/python/math.d.ts +26 -0
  77. package/generators/python/procedures.d.ts +14 -0
  78. package/generators/python/python_generator.d.ts +108 -0
  79. package/generators/python/text.d.ts +26 -0
  80. package/generators/python/variables.d.ts +14 -0
  81. package/generators/python/variables_dynamic.d.ts +10 -0
  82. package/generators/python.d.ts +18 -0
  83. package/javascript.d.ts +1 -39
  84. package/javascript_compressed.js +37 -34
  85. package/javascript_compressed.js.map +1 -1
  86. package/lua.d.ts +1 -16
  87. package/lua_compressed.js +14 -13
  88. package/lua_compressed.js.map +1 -1
  89. package/msg/ab.js +2 -1
  90. package/msg/ace.js +1 -0
  91. package/msg/af.js +1 -0
  92. package/msg/am.js +1 -0
  93. package/msg/ar.js +8 -7
  94. package/msg/ast.js +2 -1
  95. package/msg/az.js +2 -1
  96. package/msg/ba.js +5 -4
  97. package/msg/bcc.js +6 -5
  98. package/msg/be-tarask.js +1 -0
  99. package/msg/be.js +1 -0
  100. package/msg/bg.js +4 -3
  101. package/msg/bn.js +1 -0
  102. package/msg/br.js +3 -2
  103. package/msg/bs.js +1 -0
  104. package/msg/ca.js +1 -0
  105. package/msg/cdo.js +1 -0
  106. package/msg/ce.js +441 -0
  107. package/msg/cs.js +1 -0
  108. package/msg/da.js +1 -0
  109. package/msg/de.js +3 -2
  110. package/msg/diq.js +5 -4
  111. package/msg/dtp.js +441 -0
  112. package/msg/dty.js +2 -1
  113. package/msg/ee.js +3 -2
  114. package/msg/el.js +2 -1
  115. package/msg/en-gb.js +1 -0
  116. package/msg/en.js +1 -0
  117. package/msg/eo.js +1 -0
  118. package/msg/es.js +1 -0
  119. package/msg/et.js +1 -0
  120. package/msg/eu.js +1 -0
  121. package/msg/fa.js +5 -4
  122. package/msg/fi.js +1 -0
  123. package/msg/fo.js +1 -0
  124. package/msg/fr.js +2 -1
  125. package/msg/frr.js +1 -0
  126. package/msg/gl.js +2 -1
  127. package/msg/gn.js +2 -1
  128. package/msg/gor.js +1 -0
  129. package/msg/ha.js +1 -0
  130. package/msg/hak.js +1 -0
  131. package/msg/he.js +3 -2
  132. package/msg/hi.js +1 -0
  133. package/msg/hr.js +2 -1
  134. package/msg/hrx.js +1 -0
  135. package/msg/hsb.js +441 -0
  136. package/msg/hu.js +1 -0
  137. package/msg/hy.js +9 -8
  138. package/msg/ia.js +1 -0
  139. package/msg/id.js +5 -4
  140. package/msg/ig.js +1 -0
  141. package/msg/inh.js +1 -0
  142. package/msg/is.js +1 -0
  143. package/msg/it.js +2 -1
  144. package/msg/ja.js +1 -0
  145. package/msg/ka.js +1 -0
  146. package/msg/kab.js +5 -4
  147. package/msg/kbd-cyrl.js +1 -0
  148. package/msg/km.js +10 -9
  149. package/msg/kn.js +31 -30
  150. package/msg/ko.js +2 -1
  151. package/msg/ksh.js +1 -0
  152. package/msg/ku-latn.js +1 -0
  153. package/msg/ky.js +4 -3
  154. package/msg/la.js +1 -0
  155. package/msg/lb.js +1 -0
  156. package/msg/lki.js +5 -4
  157. package/msg/lo.js +2 -1
  158. package/msg/lrc.js +1 -0
  159. package/msg/lt.js +5 -4
  160. package/msg/lv.js +1 -0
  161. package/msg/mg.js +1 -0
  162. package/msg/mk.js +2 -1
  163. package/msg/ml.js +1 -0
  164. package/msg/mnw.js +2 -1
  165. package/msg/ms.js +2 -1
  166. package/msg/my.js +2 -1
  167. package/msg/mzn.js +1 -0
  168. package/msg/nb.js +1 -0
  169. package/msg/ne.js +3 -2
  170. package/msg/nl.js +2 -1
  171. package/msg/oc.js +1 -0
  172. package/msg/olo.js +1 -0
  173. package/msg/pa.js +1 -0
  174. package/msg/pl.js +3 -2
  175. package/msg/pms.js +1 -0
  176. package/msg/ps.js +1 -0
  177. package/msg/pt-br.js +1 -0
  178. package/msg/pt.js +17 -16
  179. package/msg/ro.js +2 -1
  180. package/msg/ru.js +7 -6
  181. package/msg/sc.js +2 -1
  182. package/msg/sco.js +1 -0
  183. package/msg/sd.js +1 -0
  184. package/msg/shn.js +2 -1
  185. package/msg/si.js +1 -0
  186. package/msg/sk.js +1 -0
  187. package/msg/skr-arab.js +2 -1
  188. package/msg/sl.js +1 -0
  189. package/msg/smn.js +1 -0
  190. package/msg/sq.js +17 -16
  191. package/msg/sr-latn.js +3 -2
  192. package/msg/sr.js +2 -1
  193. package/msg/sv.js +1 -0
  194. package/msg/sw.js +1 -0
  195. package/msg/ta.js +13 -12
  196. package/msg/tcy.js +6 -5
  197. package/msg/tdd.js +2 -1
  198. package/msg/te.js +2 -1
  199. package/msg/th.js +2 -1
  200. package/msg/ti.js +1 -0
  201. package/msg/tl.js +2 -1
  202. package/msg/tlh.js +1 -0
  203. package/msg/tr.js +2 -1
  204. package/msg/ug-arab.js +15 -14
  205. package/msg/uk.js +3 -2
  206. package/msg/ur.js +5 -4
  207. package/msg/uz.js +1 -0
  208. package/msg/vi.js +2 -1
  209. package/msg/xmf.js +1 -0
  210. package/msg/yo.js +2 -1
  211. package/msg/yue.js +1 -0
  212. package/msg/zgh.js +1 -0
  213. package/msg/zh-hans.js +2 -1
  214. package/msg/zh-hant.js +1 -0
  215. package/package.json +2 -2
  216. package/php.d.ts +1 -41
  217. package/php_compressed.js +26 -22
  218. package/php_compressed.js.map +1 -1
  219. package/python.d.ts +1 -25
  220. package/python_compressed.js +14 -12
  221. package/python_compressed.js.map +1 -1
package/core/block.d.ts CHANGED
@@ -397,6 +397,8 @@ export declare class Block implements IASTNodeLocation, IDeletable {
397
397
  isShadow(): boolean;
398
398
  /**
399
399
  * Set whether this block is a shadow block or not.
400
+ * This method is internal and should not be called by users of Blockly. To
401
+ * create shadow blocks programmatically call connection.setShadowState
400
402
  *
401
403
  * @param shadow True if a shadow.
402
404
  * @internal
@@ -30,6 +30,10 @@ export declare class BlockDragger implements IBlockDragger {
30
30
  /** Whether the block would be deleted if dropped immediately. */
31
31
  protected wouldDeleteBlock_: boolean;
32
32
  protected startXY_: Coordinate;
33
+ /**
34
+ * @deprecated To be removed in v11. Updating icons is now handled by the
35
+ * block's `moveDuringDrag` method.
36
+ */
33
37
  protected dragIconData_: IconPositionData[];
34
38
  /**
35
39
  * @param block The block to drag.
@@ -138,10 +142,10 @@ export declare class BlockDragger implements IBlockDragger {
138
142
  /**
139
143
  * Move all of the icons connected to this drag.
140
144
  *
141
- * @param dxy How far to move the icons from their original positions, in
142
- * workspace units.
145
+ * @deprecated To be removed in v11. This is now handled by the block's
146
+ * `moveDuringDrag` method.
143
147
  */
144
- protected dragIcons_(dxy: Coordinate): void;
148
+ protected dragIcons_(): void;
145
149
  /**
146
150
  * Get a list of the insertion markers that currently exist. Drags have 0, 1,
147
151
  * or 2 insertion markers.
@@ -97,6 +97,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
97
97
  * is currently scheduled.
98
98
  */
99
99
  private bumpNeighboursPid;
100
+ /** Whether this block is currently being dragged. */
101
+ private dragging;
100
102
  /**
101
103
  * The location of the top left of this block (in workspace coordinates)
102
104
  * relative to either its parent block, or the workspace origin if it has no
@@ -253,14 +255,16 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
253
255
  */
254
256
  showContextMenu(e: Event): void;
255
257
  /**
256
- * Move the connections for this block and all blocks attached under it.
257
- * Also update any attached bubbles.
258
+ * Updates the locations of any parts of the block that need to know where
259
+ * they are (e.g. connections, icons).
258
260
  *
259
- * @param dx Horizontal offset from current location, in workspace units.
260
- * @param dy Vertical offset from current location, in workspace units.
261
+ * @param blockOrigin The top-left of this block in workspace coordinates.
261
262
  * @internal
262
263
  */
263
- moveConnections(dx: number, dy: number): void;
264
+ updateComponentLocations(blockOrigin: Coordinate): void;
265
+ private updateConnectionLocations;
266
+ private updateIconLocations;
267
+ private updateFieldLocations;
264
268
  /**
265
269
  * Recursively adds or removes the dragging class to this node and its
266
270
  * children.
@@ -283,6 +287,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
283
287
  setEditable(editable: boolean): void;
284
288
  /**
285
289
  * Sets whether this block is a shadow block or not.
290
+ * This method is internal and should not be called by users of Blockly. To
291
+ * create shadow blocks programmatically call connection.setShadowState
286
292
  *
287
293
  * @param shadow True if a shadow.
288
294
  * @internal
@@ -623,14 +629,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
623
629
  tightenChildrenEfficiently(): void;
624
630
  /** Redraw any attached marker or cursor svgs if needed. */
625
631
  protected updateMarkers_(): void;
626
- /**
627
- * Update all of the connections on this block with the new locations
628
- * calculated during rendering. Also move all of the connected blocks based
629
- * on the new connection locations.
630
- *
631
- * @internal
632
- */
633
- private updateConnectionAndIconLocations;
634
632
  /**
635
633
  * Add the cursor SVG to this block's SVG group.
636
634
  *
@@ -55,6 +55,12 @@ export declare class BlockFieldIntermediateChange extends BlockBase {
55
55
  * @returns False if something changed.
56
56
  */
57
57
  isNull(): boolean;
58
+ /**
59
+ * Run a change event.
60
+ *
61
+ * @param forward True if run forward, false if run backward (undo).
62
+ */
63
+ run(forward: boolean): void;
58
64
  }
59
65
  export interface BlockFieldIntermediateChangeJson extends BlockBaseJson {
60
66
  name: string;
package/core/field.d.ts CHANGED
@@ -313,6 +313,17 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
313
313
  * @returns Whether this field is clickable.
314
314
  */
315
315
  isClickable(): boolean;
316
+ /**
317
+ * Check whether the field should be clickable while the block is in a flyout.
318
+ * The default is that fields are clickable in always-open flyouts such as the
319
+ * simple toolbox, but not in autoclosing flyouts such as the category toolbox.
320
+ * Subclasses may override this function to change this behavior. Note that
321
+ * `isClickable` must also return true for this to have any effect.
322
+ *
323
+ * @param autoClosingFlyout true if the containing flyout is an auto-closing one.
324
+ * @returns Whether the field should be clickable while the block is in a flyout.
325
+ */
326
+ isClickableInFlyout(autoClosingFlyout: boolean): boolean;
316
327
  /**
317
328
  * Check whether this field is currently editable. Some fields are never
318
329
  * EDITABLE (e.g. text labels). Other fields may be EDITABLE but may exist on
@@ -483,6 +494,13 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
483
494
  * @internal
484
495
  */
485
496
  getScaledBBox(): Rect;
497
+ /**
498
+ * Notifies the field that it has changed locations.
499
+ *
500
+ * @param _ The location of this field's block's top-start corner
501
+ * in workspace coordinates.
502
+ */
503
+ onLocationChange(_: Coordinate): void;
486
504
  /**
487
505
  * Get the text from this field to display on the block. May differ from
488
506
  * `getText` due to ellipsis, and other formatting.
@@ -113,6 +113,11 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
113
113
  * @returns Height and width.
114
114
  */
115
115
  getSize(): Size;
116
+ /**
117
+ * Notifies the field that it has changed locations. Moves the widget div to
118
+ * be in the correct place if it is open.
119
+ */
120
+ onLocationChange(): void;
116
121
  /**
117
122
  * Updates the colour of the htmlInput given the current validity of the
118
123
  * field's value.
@@ -204,7 +209,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
204
209
  /**
205
210
  * Handles repositioning the WidgetDiv used for input fields when the
206
211
  * workspace is resized. Will bump the block into the viewport and update the
207
- * position of the field if necessary.
212
+ * position of the text input if necessary.
208
213
  *
209
214
  * @returns True for rendered workspaces, as we never want to hide the widget
210
215
  * div.
@@ -12,6 +12,7 @@ import { Coordinate } from './utils/coordinate.js';
12
12
  import { Svg } from './utils/svg.js';
13
13
  import * as toolbox from './utils/toolbox.js';
14
14
  import { WorkspaceSvg } from './workspace_svg.js';
15
+ import { IAutoHideable } from './interfaces/i_autohideable.js';
15
16
  declare enum FlyoutItemType {
16
17
  BLOCK = "block",
17
18
  BUTTON = "button"
@@ -19,7 +20,7 @@ declare enum FlyoutItemType {
19
20
  /**
20
21
  * Class for a flyout.
21
22
  */
22
- export declare abstract class Flyout extends DeleteArea implements IFlyout {
23
+ export declare abstract class Flyout extends DeleteArea implements IAutoHideable, IFlyout {
23
24
  /**
24
25
  * Position the flyout.
25
26
  */
@@ -251,6 +252,13 @@ export declare abstract class Flyout extends DeleteArea implements IFlyout {
251
252
  * @returns The workspace inside the flyout.
252
253
  */
253
254
  getWorkspace(): WorkspaceSvg;
255
+ /**
256
+ * Sets whether this flyout automatically closes when blocks are dragged out,
257
+ * the workspace is clicked, etc, or not.
258
+ */
259
+ setAutoClose(autoClose: boolean): void;
260
+ /** Automatically hides the flyout if it is an autoclosing flyout. */
261
+ autoHide(onlyClosePopups: boolean): void;
254
262
  /**
255
263
  * Is the flyout visible?
256
264
  *
package/core/gesture.d.ts CHANGED
@@ -419,13 +419,13 @@ export declare class Gesture {
419
419
  */
420
420
  private isBlockClick;
421
421
  /**
422
- * Whether this gesture is a click on a field. This should only be called
422
+ * Whether this gesture is a click on a field that should be handled. This should only be called
423
423
  * when ending a gesture (pointerup).
424
424
  *
425
425
  * @returns Whether this gesture was a click on a field.
426
426
  */
427
427
  private isFieldClick;
428
- /** @returns Whether this gesture is a click on an icon. */
428
+ /** @returns Whether this gesture is a click on an icon that should be handled. */
429
429
  private isIconClick;
430
430
  /**
431
431
  * Whether this gesture is a click on a workspace. This should only be called
@@ -70,6 +70,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
70
70
  /** Applies the given state to this comment. */
71
71
  loadState(state: CommentState): void;
72
72
  onClick(): void;
73
+ isClickableInFlyout(): boolean;
73
74
  /**
74
75
  * Updates the text of this comment in response to changes in the text of
75
76
  * the input bubble.
@@ -8,6 +8,7 @@ import type { IIcon } from '../interfaces/i_icon.js';
8
8
  import { Coordinate } from '../utils/coordinate.js';
9
9
  import { Size } from '../utils/size.js';
10
10
  import type { IconType } from './icon_types.js';
11
+ import * as tooltip from '../tooltip.js';
11
12
  /**
12
13
  * The abstract icon class. Icons are visual elements that live in the top-start
13
14
  * corner of the block. Usually they provide more "meta" information about a
@@ -25,12 +26,21 @@ export declare abstract class Icon implements IIcon {
25
26
  protected workspaceLocation: Coordinate;
26
27
  /** The root svg element visually representing this icon. */
27
28
  protected svgRoot: SVGGElement | null;
29
+ /** The tooltip for this icon. */
30
+ protected tooltip: tooltip.TipInfo;
28
31
  constructor(sourceBlock: Block);
29
32
  getType(): IconType<IIcon>;
30
33
  initView(pointerdownListener: (e: PointerEvent) => void): void;
31
34
  dispose(): void;
32
35
  getWeight(): number;
33
36
  getSize(): Size;
37
+ /**
38
+ * Sets the tooltip for this icon to the given value. Null to show the
39
+ * tooltip of the block.
40
+ */
41
+ setTooltip(tip: tooltip.TipInfo | null): void;
42
+ /** Returns the tooltip for this icon. */
43
+ getTooltip(): tooltip.TipInfo;
34
44
  applyColour(): void;
35
45
  updateEditable(): void;
36
46
  updateCollapsed(): void;
@@ -40,6 +50,15 @@ export declare abstract class Icon implements IIcon {
40
50
  private updateSvgRootOffset;
41
51
  onLocationChange(blockOrigin: Coordinate): void;
42
52
  onClick(): void;
53
+ /**
54
+ * Check whether the icon should be clickable while the block is in a flyout.
55
+ * The default is that icons are clickable in all flyouts (auto-closing or not).
56
+ * Subclasses may override this function to change this behavior.
57
+ *
58
+ * @param autoClosingFlyout true if the containing flyout is an auto-closing one.
59
+ * @returns Whether the icon should be clickable while the block is in a flyout.
60
+ */
61
+ isClickableInFlyout(autoClosingFlyout: boolean): boolean;
43
62
  /**
44
63
  * Sets the visibility of the icon's bubble if one exists.
45
64
  *
@@ -53,6 +53,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
53
53
  updateCollapsed(): void;
54
54
  onLocationChange(blockOrigin: Coordinate): void;
55
55
  onClick(): void;
56
+ isClickableInFlyout(): boolean;
56
57
  bubbleIsVisible(): boolean;
57
58
  setBubbleVisible(visible: boolean): void;
58
59
  /** @returns the configuration the mini workspace should have. */
@@ -57,6 +57,7 @@ export declare class WarningIcon extends Icon implements IHasBubble {
57
57
  getText(): string;
58
58
  /** Toggles the visibility of the bubble. */
59
59
  onClick(): void;
60
+ isClickableInFlyout(): boolean;
60
61
  bubbleIsVisible(): boolean;
61
62
  setBubbleVisible(visible: boolean): void;
62
63
  /**
@@ -69,6 +69,14 @@ export interface IIcon {
69
69
  * Notifies the icon that it has been clicked.
70
70
  */
71
71
  onClick(): void;
72
+ /**
73
+ * Check whether the icon should be clickable while the block is in a flyout.
74
+ * If this function is not defined, the icon will be clickable in all flyouts.
75
+ *
76
+ * @param autoClosingFlyout true if the containing flyout is an auto-closing one.
77
+ * @returns Whether the icon should be clickable while the block is in a flyout.
78
+ */
79
+ isClickableInFlyout?(autoClosingFlyout: boolean): boolean;
72
80
  }
73
81
  /** Type guard that checks whether the given object is an IIcon. */
74
82
  export declare function isIcon(obj: any): obj is IIcon;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /** @internal */
7
+ export interface IRenderedElement {
8
+ /**
9
+ * @returns The root SVG element of htis rendered element.
10
+ */
11
+ getSvgRoot(): SVGElement;
12
+ }
13
+ /**
14
+ * @returns True if the given object is an IRenderedElement.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function isRenderedElement(obj: any): obj is IRenderedElement;
19
+ //# sourceMappingURL=i_rendered_element.d.ts.map
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { WorkspaceSvg } from './workspace_svg.js';
7
+ import { IRenderedElement } from './interfaces/i_rendered_element.js';
8
+ import { Coordinate } from './utils/coordinate.js';
9
+ /** @internal */
10
+ export declare class LayerManager {
11
+ private workspace;
12
+ /** The layer elements being dragged are appended to. */
13
+ private dragLayer;
14
+ /** The layers elements not being dragged are appended to. */
15
+ private layers;
16
+ /** @internal */
17
+ constructor(workspace: WorkspaceSvg);
18
+ private createDragLayer;
19
+ /**
20
+ * Translates layers when the workspace is dragged or zoomed.
21
+ *
22
+ * @internal
23
+ */
24
+ translateLayers(newCoord: Coordinate, newScale: number): void;
25
+ /**
26
+ * Moves the given element to the drag layer, which exists on top of all other
27
+ * layers, and the drag surface.
28
+ *
29
+ * @internal
30
+ */
31
+ moveToDragLayer(elem: IRenderedElement): void;
32
+ /**
33
+ * Moves the given element off of the drag layer.
34
+ *
35
+ * @internal
36
+ */
37
+ moveOffDragLayer(elem: IRenderedElement, layerNum: number): void;
38
+ /**
39
+ * Appends the given element to a layer. If the layer does not exist, it is
40
+ * created.
41
+ *
42
+ * @internal
43
+ */
44
+ append(elem: IRenderedElement, layerNum: number): void;
45
+ /**
46
+ * Creates a layer and inserts it at the proper place given the layer number.
47
+ *
48
+ * More positive layers exist later in the dom and are rendered ontop of
49
+ * less positive layers. Layers are added to the layer map as a side effect.
50
+ */
51
+ private createLayer;
52
+ /**
53
+ * Returns true if the given element is a layer managed by the layer manager.
54
+ * False otherwise.
55
+ *
56
+ * @internal
57
+ */
58
+ hasLayer(elem: SVGElement): boolean;
59
+ /**
60
+ * We need to be able to access this layer explicitly for backwards
61
+ * compatibility.
62
+ *
63
+ * @internal
64
+ */
65
+ getBlockLayer(): SVGGElement;
66
+ /**
67
+ * We need to be able to access this layer explicitly for backwards
68
+ * compatibility.
69
+ *
70
+ * @internal
71
+ */
72
+ getBubbleLayer(): SVGGElement;
73
+ }
74
+ //# sourceMappingURL=layer_manager.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The layer to place blocks on.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare const BLOCK = 50;
12
+ /**
13
+ * The layer to place bubbles on.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare const BUBBLE = 100;
18
+ //# sourceMappingURL=layers.d.ts.map
@@ -105,12 +105,6 @@ export declare class RenderedConnection extends Connection {
105
105
  * @returns The offset of the connection.
106
106
  */
107
107
  getOffsetInBlock(): Coordinate;
108
- /**
109
- * Move the blocks on either side of this connection right next to each other.
110
- *
111
- * @internal
112
- */
113
- tighten(): void;
114
108
  /**
115
109
  * Moves the blocks on either side of this connection right next to
116
110
  * each other, based on their local offsets, not global positions.
@@ -58,11 +58,12 @@ export interface State {
58
58
  * @returns The serialized state of the block, or null if the block could not be
59
59
  * serialied (eg it was an insertion marker).
60
60
  */
61
- export declare function save(block: Block, { addCoordinates, addInputBlocks, addNextBlocks, doFullSerialization, }?: {
61
+ export declare function save(block: Block, { addCoordinates, addInputBlocks, addNextBlocks, doFullSerialization, saveIds, }?: {
62
62
  addCoordinates?: boolean;
63
63
  addInputBlocks?: boolean;
64
64
  addNextBlocks?: boolean;
65
65
  doFullSerialization?: boolean;
66
+ saveIds?: boolean;
66
67
  }): State | null;
67
68
  /**
68
69
  * Loads the block represented by the given state into the given workspace.
@@ -46,6 +46,7 @@ import { WorkspaceAudio } from './workspace_audio.js';
46
46
  import { WorkspaceComment } from './workspace_comment.js';
47
47
  import { ZoomControls } from './zoom_controls.js';
48
48
  import { ContextMenuOption } from './contextmenu_registry.js';
49
+ import { LayerManager } from './layer_manager.js';
49
50
  /**
50
51
  * Class for a workspace. This is an onscreen area with optional trashcan,
51
52
  * scrollbars, bubbles, and dragging.
@@ -187,6 +188,11 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
187
188
  * @param e The right-click event that triggered the context menu.
188
189
  */
189
190
  configureContextMenu: ((menuOptions: ContextMenuOption[], e: Event) => void) | null;
191
+ /**
192
+ * A dummy wheel event listener used as a workaround for a Safari scrolling issue.
193
+ * Set in createDom and used for removal in dispose to ensure proper cleanup.
194
+ */
195
+ private dummyWheelListener;
190
196
  /**
191
197
  * In a flyout, the target workspace where blocks should be placed after a
192
198
  * drag. Otherwise null.
@@ -236,6 +242,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
236
242
  /** The recorded drag targets. */
237
243
  private dragTargetAreas;
238
244
  private readonly cachedParentSvgSize;
245
+ private layerManager;
239
246
  svgGroup_: SVGElement;
240
247
  svgBackground_: SVGElement;
241
248
  svgBlockCanvas_: SVGElement;
@@ -415,7 +422,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
415
422
  * 'blocklyMutatorBackground'.
416
423
  * @returns The workspace's SVG group.
417
424
  */
418
- createDom(opt_backgroundClass?: string): Element;
425
+ createDom(opt_backgroundClass?: string, injectionDiv?: Element): Element;
419
426
  /**
420
427
  * Dispose of this workspace.
421
428
  * Unlink from all DOM elements to prevent memory leaks.
@@ -489,6 +496,12 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
489
496
  * @internal
490
497
  */
491
498
  updateScreenCalculationsIfScrolled(): void;
499
+ /**
500
+ * @returns The layer manager for this workspace.
501
+ *
502
+ * @internal
503
+ */
504
+ getLayerManager(): LayerManager | null;
492
505
  /**
493
506
  * Get the SVG element that forms the drawing surface.
494
507
  *
package/dart.d.ts CHANGED
@@ -4,25 +4,4 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- export enum Order {
8
- ATOMIC = 0, // 0 "" ...
9
- UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?.
10
- UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr
11
- MULTIPLICATIVE = 3, // * / % ~/
12
- ADDITIVE = 4, // + -
13
- SHIFT = 5, // << >>
14
- BITWISE_AND = 6, // &
15
- BITWISE_XOR = 7, // ^
16
- BITWISE_OR = 8, // |
17
- RELATIONAL = 9, // >= > <= < as is is!
18
- EQUALITY = 10, // == !=
19
- LOGICAL_AND = 11, // &&
20
- LOGICAL_OR = 12, // ||
21
- IF_NULL = 13, // ??
22
- CONDITIONAL = 14, // expr ? expr : expr
23
- CASCADE = 15, // ..
24
- ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |=
25
- NONE = 99, // (...)
26
- }
27
-
28
- export declare const dartGenerator: any;
7
+ export * from 'generators/dart';
@@ -137,10 +137,10 @@ Order$$module$build$src$generators$dart$dart_generator.LOGICAL_OR;let e=b.valueT
137
137
  $.NameType$$module$build$src$core$names.VARIABLE);let f=c;c.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$dart$loops=function(a,b){const c="UNTIL"===a.getFieldValue("MODE");let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:
138
138
  Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"},controls_for$$module$build$src$generators$dart$loops=function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";const f=b.valueToCode(a,"BY",
139
139
  Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.isNumber$$module$build$src$core$utils$string(d)&&$.isNumber$$module$build$src$core$utils$string(e)&&$.isNumber$$module$build$src$core$utils$string(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=1===c?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(d)||
140
- (h=b.nameDB_.getDistinctName(c+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;e.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$build$src$core$names.VARIABLE);a+="num "+e+" = ";a=$.isNumber$$module$build$src$core$utils$string(f)?a+(Math.abs(f)+";\n"):a+("("+f+").abs();\n");
141
- a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach$$module$build$src$generators$dart$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"},controls_flow_statements$$module$build$src$generators$dart$loops=
142
- function(a,b){let c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){const d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},math_number$$module$build$src$generators$dart$math=function(a,b){a=Number(a.getFieldValue("NUM"));Infinity===
143
- a?(a="double.infinity",b=Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX):-Infinity===a?(a="-double.infinity",b=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX):b=0>a?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:Order$$module$build$src$generators$dart$dart_generator.ATOMIC;return[a,b]},math_arithmetic$$module$build$src$generators$dart$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],
140
+ (h=b.nameDB_.getDistinctName(c+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;e.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$build$src$core$names.VARIABLE);a+="num "+e+" = ";a=$.isNumber$$module$build$src$core$utils$string(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+
141
+ ").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach$$module$build$src$generators$dart$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"},
142
+ controls_flow_statements$$module$build$src$generators$dart$loops=function(a,b){let c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){const d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},math_number$$module$build$src$generators$dart$math=
143
+ function(a,b){a=Number(a.getFieldValue("NUM"));return Infinity===a?["double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]:-Infinity===a?["-double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX]:[String(a),0>a?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},math_arithmetic$$module$build$src$generators$dart$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],
144
144
  MINUS:[" - ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],MULTIPLY:[" * ",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],DIVIDE:[" / ",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],POWER:[null,Order$$module$build$src$generators$dart$dart_generator.NONE]}[a.getFieldValue("OP")];const d=c[0];c=c[1];const e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",
145
145
  ["Math.pow("+e+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX])},math_single$$module$build$src$generators$dart$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"===c)return a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX)||"0","-"===a[0]&&(a=" "+a),["-"+a,Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a="ABS"===c||"ROUND"===c.substring(0,
146
146
  5)?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"0":"SIN"===c||"COS"===c||"TAN"===c?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0";switch(c){case "ABS":d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+
@@ -349,13 +349,16 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(String haystack, String needle) {
349
349
  }
350
350
  `)+"("+c+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_replace$$module$build$src$generators$dart$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},
351
351
  text_reverse$$module$build$src$generators$dart$text=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX]},variables_get$$module$build$src$generators$dart$variables=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},variables_set$$module$build$src$generators$dart$variables=
352
- function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Order$$module$build$src$generators$dart$dart_generator={ATOMIC:0,UNARY_POSTFIX:1,UNARY_PREFIX:2,MULTIPLICATIVE:3,ADDITIVE:4,SHIFT:5,BITWISE_AND:6,BITWISE_XOR:7,BITWISE_OR:8,RELATIONAL:9,EQUALITY:10,LOGICAL_AND:11,LOGICAL_OR:12,IF_NULL:13,CONDITIONAL:14,CASCADE:15,ASSIGNMENT:16,NONE:99},DartGenerator$$module$build$src$generators$dart$dart_generator=
353
- class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a){super(null!=a?a:"Dart");this.isInitialized=!1;for(const b in Order$$module$build$src$generators$dart$dart_generator)this["ORDER_"+b]=Order$$module$build$src$generators$dart$dart_generator[b];this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init();
352
+ function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Order$$module$build$src$generators$dart$dart_generator;
353
+ (function(a){a[a.ATOMIC=0]="ATOMIC";a[a.UNARY_POSTFIX=1]="UNARY_POSTFIX";a[a.UNARY_PREFIX=2]="UNARY_PREFIX";a[a.MULTIPLICATIVE=3]="MULTIPLICATIVE";a[a.ADDITIVE=4]="ADDITIVE";a[a.SHIFT=5]="SHIFT";a[a.BITWISE_AND=6]="BITWISE_AND";a[a.BITWISE_XOR=7]="BITWISE_XOR";a[a.BITWISE_OR=8]="BITWISE_OR";a[a.RELATIONAL=9]="RELATIONAL";a[a.EQUALITY=10]="EQUALITY";a[a.LOGICAL_AND=11]="LOGICAL_AND";a[a.LOGICAL_OR=12]="LOGICAL_OR";a[a.IF_NULL=13]="IF_NULL";a[a.CONDITIONAL=14]="CONDITIONAL";a[a.CASCADE=15]="CASCADE";
354
+ a[a.ASSIGNMENT=16]="ASSIGNMENT";a[a.NONE=99]="NONE"})(Order$$module$build$src$generators$dart$dart_generator||(Order$$module$build$src$generators$dart$dart_generator={}));
355
+ var DartGenerator$$module$build$src$generators$dart$dart_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a="Dart"){super(a);this.isInitialized=!1;for(const b in Order$$module$build$src$generators$dart$dart_generator)a=Order$$module$build$src$generators$dart$dart_generator[b],"string"!==typeof a&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);
354
356
  this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$build$src$core$names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.allDeveloperVariables$$module$build$src$core$variables(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));a=$.allUsedVarModels$$module$build$src$core$variables(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),
355
357
  $.NameType$$module$build$src$core$names.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));a="main() {\n"+a+"}";const b=[],c=[];for(let d in this.definitions_){const e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+
356
- ";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,b,c){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d=a.getProcedureDef?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===
357
- $.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,b,c,d,e){c=c||0;e=e||this.ORDER_NONE;a.workspace.options.oneBasedIndex&&c--;const f=a.workspace.options.oneBasedIndex?"1":"0";let g,h;c?h=g=this.ORDER_ADDITIVE:d?h=g=this.ORDER_UNARY_PREFIX:g=e;a=this.valueToCode(a,b,g)||f;$.isNumber$$module$build$src$core$utils$string(a)?
358
- (a=parseInt(a,10)+c,d&&(a=-a)):(0<c?a=a+" + "+c:0>c&&(a=a+" - "+-c),d&&(a=c?"-("+a+")":"-"+a),h=Math.floor(h),e=Math.floor(e),h&&e>=h&&(a="("+a+")"));return a}},module$build$src$generators$dart$dart_generator={};module$build$src$generators$dart$dart_generator.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;module$build$src$generators$dart$dart_generator.Order=Order$$module$build$src$generators$dart$dart_generator;var module$build$src$generators$dart$colour={};module$build$src$generators$dart$colour.colour_blend=colour_blend$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_picker=colour_picker$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_random=colour_random$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_rgb=colour_rgb$$module$build$src$generators$dart$colour;var module$build$src$generators$dart$lists={};module$build$src$generators$dart$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_create_with=lists_create_with$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$dart$lists;
358
+ ";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,b,c=!1){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d=a.getProcedureDef?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===
359
+ $.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,b,c=0,d=!1,e=Order$$module$build$src$generators$dart$dart_generator.NONE){a.workspace.options.oneBasedIndex&&c--;const f=a.workspace.options.oneBasedIndex?"1":"0";let g=e;c?g=Order$$module$build$src$generators$dart$dart_generator.ADDITIVE:
360
+ d&&(g=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(0===c&&!d)return a;if($.isNumber$$module$build$src$core$utils$string(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;0<c?a=`${a} + ${c}`:0>c&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}},module$build$src$generators$dart$dart_generator={};module$build$src$generators$dart$dart_generator.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;
361
+ module$build$src$generators$dart$dart_generator.Order=Order$$module$build$src$generators$dart$dart_generator;var module$build$src$generators$dart$colour={};module$build$src$generators$dart$colour.colour_blend=colour_blend$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_picker=colour_picker$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_random=colour_random$$module$build$src$generators$dart$colour;module$build$src$generators$dart$colour.colour_rgb=colour_rgb$$module$build$src$generators$dart$colour;var module$build$src$generators$dart$lists={};module$build$src$generators$dart$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_create_with=lists_create_with$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$dart$lists;
359
362
  module$build$src$generators$dart$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_length=lists_length$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_repeat=lists_repeat$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_reverse=lists_reverse$$module$build$src$generators$dart$lists;
360
363
  module$build$src$generators$dart$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_sort=lists_sort$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_split=lists_split$$module$build$src$generators$dart$lists;var controls_ifelse$$module$build$src$generators$dart$logic=controls_if$$module$build$src$generators$dart$logic,module$build$src$generators$dart$logic={};module$build$src$generators$dart$logic.controls_if=controls_if$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.controls_ifelse=controls_if$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_boolean=logic_boolean$$module$build$src$generators$dart$logic;
361
364
  module$build$src$generators$dart$logic.logic_compare=logic_compare$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_negate=logic_negate$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_null=logic_null$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_operation=logic_operation$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_ternary=logic_ternary$$module$build$src$generators$dart$logic;var controls_repeat$$module$build$src$generators$dart$loops=controls_repeat_ext$$module$build$src$generators$dart$loops,module$build$src$generators$dart$loops={};module$build$src$generators$dart$loops.controls_flow_statements=controls_flow_statements$$module$build$src$generators$dart$loops;module$build$src$generators$dart$loops.controls_for=controls_for$$module$build$src$generators$dart$loops;module$build$src$generators$dart$loops.controls_forEach=controls_forEach$$module$build$src$generators$dart$loops;
@@ -367,8 +370,8 @@ module$build$src$generators$dart$procedures.procedures_defnoreturn=procedures_de
367
370
  module$build$src$generators$dart$text.text_count=text_count$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_getSubstring=text_getSubstring$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_indexOf=text_indexOf$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_isEmpty=text_isEmpty$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_join=text_join$$module$build$src$generators$dart$text;
368
371
  module$build$src$generators$dart$text.text_length=text_length$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_multiline=text_multiline$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_print=text_print$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_prompt=text_prompt_ext$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_prompt_ext=text_prompt_ext$$module$build$src$generators$dart$text;
369
372
  module$build$src$generators$dart$text.text_replace=text_replace$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_reverse=text_reverse$$module$build$src$generators$dart$text;module$build$src$generators$dart$text.text_trim=text_trim$$module$build$src$generators$dart$text;var module$build$src$generators$dart$variables={};module$build$src$generators$dart$variables.variables_get=variables_get$$module$build$src$generators$dart$variables;module$build$src$generators$dart$variables.variables_set=variables_set$$module$build$src$generators$dart$variables;var module$build$src$generators$dart$variables_dynamic={};module$build$src$generators$dart$variables_dynamic.variables_get_dynamic=variables_get$$module$build$src$generators$dart$variables;module$build$src$generators$dart$variables_dynamic.variables_set_dynamic=variables_set$$module$build$src$generators$dart$variables;var dartGenerator$$module$build$src$generators$dart=new DartGenerator$$module$build$src$generators$dart$dart_generator;dartGenerator$$module$build$src$generators$dart.addReservedWords("Html,Math");
370
- Object.assign(dartGenerator$$module$build$src$generators$dart.forBlock,module$build$src$generators$dart$colour,module$build$src$generators$dart$lists,module$build$src$generators$dart$logic,module$build$src$generators$dart$loops,module$build$src$generators$dart$math,module$build$src$generators$dart$procedures,module$build$src$generators$dart$text,module$build$src$generators$dart$variables,module$build$src$generators$dart$variables_dynamic);var module$build$src$generators$dart={};
371
- module$build$src$generators$dart.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;module$build$src$generators$dart.Order=Order$$module$build$src$generators$dart$dart_generator;module$build$src$generators$dart.dartGenerator=dartGenerator$$module$build$src$generators$dart;
373
+ var generators$$module$build$src$generators$dart=Object.assign({},module$build$src$generators$dart$colour,module$build$src$generators$dart$lists,module$build$src$generators$dart$logic,module$build$src$generators$dart$loops,module$build$src$generators$dart$math,module$build$src$generators$dart$procedures,module$build$src$generators$dart$text,module$build$src$generators$dart$variables,module$build$src$generators$dart$variables_dynamic);
374
+ for(const a in generators$$module$build$src$generators$dart)dartGenerator$$module$build$src$generators$dart.forBlock[a]=generators$$module$build$src$generators$dart[a];var module$build$src$generators$dart={};module$build$src$generators$dart.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;module$build$src$generators$dart.Order=Order$$module$build$src$generators$dart$dart_generator;module$build$src$generators$dart.dartGenerator=dartGenerator$$module$build$src$generators$dart;
372
375
  module$build$src$generators$dart.__namespace__=$;
373
376
  return module$build$src$generators$dart;
374
377
  }));