blockly 11.0.0-beta.9 → 11.0.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 (286) hide show
  1. package/blockly.min.js +265 -261
  2. package/blockly.mjs +143 -0
  3. package/blockly_compressed.js +253 -249
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks.js +4 -0
  6. package/blocks.mjs +12 -0
  7. package/blocks_compressed.js +5 -5
  8. package/blocks_compressed.js.map +1 -1
  9. package/core/block.d.ts +6 -0
  10. package/core/clipboard/block_paster.d.ts +3 -1
  11. package/core/comments/comment_view.d.ts +4 -1
  12. package/core/comments/rendered_workspace_comment.d.ts +11 -1
  13. package/core/dragging/block_drag_strategy.d.ts +1 -8
  14. package/core/field.d.ts +20 -4
  15. package/core/field_input.d.ts +4 -3
  16. package/core/field_registry.d.ts +35 -3
  17. package/core/flyout_base.d.ts +8 -0
  18. package/core/grid.d.ts +9 -0
  19. package/core/interfaces/i_flyout.d.ts +10 -0
  20. package/core/keyboard_nav/ast_node.d.ts +10 -1
  21. package/core/layer_manager.d.ts +11 -0
  22. package/core.js +4 -0
  23. package/dart.js +4 -0
  24. package/dart.mjs +6 -0
  25. package/index.mjs +143 -0
  26. package/javascript.js +4 -0
  27. package/javascript.mjs +6 -0
  28. package/lua.js +4 -0
  29. package/lua.mjs +6 -0
  30. package/media/resize-handle.svg +1 -1
  31. package/msg/ab.js +7 -7
  32. package/msg/ab.mjs +423 -0
  33. package/msg/ace.js +7 -7
  34. package/msg/ace.mjs +423 -0
  35. package/msg/af.js +7 -7
  36. package/msg/af.mjs +423 -0
  37. package/msg/am.js +7 -7
  38. package/msg/am.mjs +423 -0
  39. package/msg/ar.js +7 -7
  40. package/msg/ar.mjs +423 -0
  41. package/msg/ast.js +7 -7
  42. package/msg/ast.mjs +423 -0
  43. package/msg/az.js +7 -7
  44. package/msg/az.mjs +423 -0
  45. package/msg/ba.js +7 -7
  46. package/msg/ba.mjs +423 -0
  47. package/msg/bcc.js +7 -7
  48. package/msg/bcc.mjs +423 -0
  49. package/msg/be-tarask.js +7 -7
  50. package/msg/be-tarask.mjs +423 -0
  51. package/msg/be.js +7 -7
  52. package/msg/be.mjs +423 -0
  53. package/msg/bg.js +7 -7
  54. package/msg/bg.mjs +423 -0
  55. package/msg/bn.js +7 -7
  56. package/msg/bn.mjs +423 -0
  57. package/msg/br.js +7 -7
  58. package/msg/br.mjs +423 -0
  59. package/msg/bs.js +7 -7
  60. package/msg/bs.mjs +423 -0
  61. package/msg/ca.js +7 -7
  62. package/msg/ca.mjs +423 -0
  63. package/msg/cdo.js +7 -7
  64. package/msg/cdo.mjs +423 -0
  65. package/msg/ce.js +7 -7
  66. package/msg/ce.mjs +423 -0
  67. package/msg/cs.js +7 -7
  68. package/msg/cs.mjs +423 -0
  69. package/msg/da.js +7 -7
  70. package/msg/da.mjs +423 -0
  71. package/msg/de.js +26 -26
  72. package/msg/de.mjs +423 -0
  73. package/msg/diq.js +7 -7
  74. package/msg/diq.mjs +423 -0
  75. package/msg/dtp.js +7 -7
  76. package/msg/dtp.mjs +423 -0
  77. package/msg/dty.js +7 -7
  78. package/msg/dty.mjs +423 -0
  79. package/msg/ee.js +7 -7
  80. package/msg/ee.mjs +423 -0
  81. package/msg/el.js +122 -122
  82. package/msg/el.mjs +423 -0
  83. package/msg/en-gb.js +7 -7
  84. package/msg/en-gb.mjs +423 -0
  85. package/msg/en.js +7 -7
  86. package/msg/en.mjs +423 -0
  87. package/msg/eo.js +7 -7
  88. package/msg/eo.mjs +423 -0
  89. package/msg/es.js +7 -7
  90. package/msg/es.mjs +423 -0
  91. package/msg/et.js +7 -7
  92. package/msg/et.mjs +423 -0
  93. package/msg/eu.js +7 -7
  94. package/msg/eu.mjs +423 -0
  95. package/msg/fa.js +9 -9
  96. package/msg/fa.mjs +423 -0
  97. package/msg/fi.js +7 -7
  98. package/msg/fi.mjs +423 -0
  99. package/msg/fo.js +7 -7
  100. package/msg/fo.mjs +423 -0
  101. package/msg/fr.js +10 -10
  102. package/msg/fr.mjs +423 -0
  103. package/msg/frr.js +7 -7
  104. package/msg/frr.mjs +423 -0
  105. package/msg/gl.js +8 -8
  106. package/msg/gl.mjs +423 -0
  107. package/msg/gn.js +7 -7
  108. package/msg/gn.mjs +423 -0
  109. package/msg/gor.js +7 -7
  110. package/msg/gor.mjs +423 -0
  111. package/msg/ha.js +7 -7
  112. package/msg/ha.mjs +423 -0
  113. package/msg/hak.js +7 -7
  114. package/msg/hak.mjs +423 -0
  115. package/msg/he.js +7 -7
  116. package/msg/he.mjs +423 -0
  117. package/msg/hi.js +7 -7
  118. package/msg/hi.mjs +423 -0
  119. package/msg/hr.js +7 -7
  120. package/msg/hr.mjs +423 -0
  121. package/msg/hrx.js +7 -7
  122. package/msg/hrx.mjs +423 -0
  123. package/msg/hsb.js +7 -7
  124. package/msg/hsb.mjs +423 -0
  125. package/msg/hu.js +7 -7
  126. package/msg/hu.mjs +423 -0
  127. package/msg/hy.js +7 -7
  128. package/msg/hy.mjs +423 -0
  129. package/msg/ia.js +8 -8
  130. package/msg/ia.mjs +423 -0
  131. package/msg/id.js +7 -7
  132. package/msg/id.mjs +423 -0
  133. package/msg/ig.js +7 -7
  134. package/msg/ig.mjs +423 -0
  135. package/msg/inh.js +7 -7
  136. package/msg/inh.mjs +423 -0
  137. package/msg/is.js +7 -7
  138. package/msg/is.mjs +423 -0
  139. package/msg/it.js +7 -7
  140. package/msg/it.mjs +423 -0
  141. package/msg/ja.js +7 -7
  142. package/msg/ja.mjs +423 -0
  143. package/msg/ka.js +7 -7
  144. package/msg/ka.mjs +423 -0
  145. package/msg/kab.js +7 -7
  146. package/msg/kab.mjs +423 -0
  147. package/msg/kbd-cyrl.js +7 -7
  148. package/msg/kbd-cyrl.mjs +423 -0
  149. package/msg/km.js +7 -7
  150. package/msg/km.mjs +423 -0
  151. package/msg/kn.js +7 -7
  152. package/msg/kn.mjs +423 -0
  153. package/msg/ko.js +9 -9
  154. package/msg/ko.mjs +423 -0
  155. package/msg/ksh.js +7 -7
  156. package/msg/ksh.mjs +423 -0
  157. package/msg/ku-latn.js +7 -7
  158. package/msg/ku-latn.mjs +423 -0
  159. package/msg/ky.js +7 -7
  160. package/msg/ky.mjs +423 -0
  161. package/msg/la.js +7 -7
  162. package/msg/la.mjs +423 -0
  163. package/msg/lb.js +7 -7
  164. package/msg/lb.mjs +423 -0
  165. package/msg/lki.js +7 -7
  166. package/msg/lki.mjs +423 -0
  167. package/msg/lo.js +7 -7
  168. package/msg/lo.mjs +423 -0
  169. package/msg/lrc.js +7 -7
  170. package/msg/lrc.mjs +423 -0
  171. package/msg/lt.js +7 -7
  172. package/msg/lt.mjs +423 -0
  173. package/msg/lv.js +7 -7
  174. package/msg/lv.mjs +423 -0
  175. package/msg/mg.js +7 -7
  176. package/msg/mg.mjs +423 -0
  177. package/msg/mk.js +7 -7
  178. package/msg/mk.mjs +423 -0
  179. package/msg/ml.js +7 -7
  180. package/msg/ml.mjs +423 -0
  181. package/msg/mnw.js +7 -7
  182. package/msg/mnw.mjs +423 -0
  183. package/msg/ms.js +8 -8
  184. package/msg/ms.mjs +423 -0
  185. package/msg/my.js +7 -7
  186. package/msg/my.mjs +423 -0
  187. package/msg/mzn.js +7 -7
  188. package/msg/mzn.mjs +423 -0
  189. package/msg/nb.js +7 -7
  190. package/msg/nb.mjs +423 -0
  191. package/msg/ne.js +224 -224
  192. package/msg/ne.mjs +423 -0
  193. package/msg/nl.js +14 -14
  194. package/msg/nl.mjs +423 -0
  195. package/msg/oc.js +7 -7
  196. package/msg/oc.mjs +423 -0
  197. package/msg/olo.js +7 -7
  198. package/msg/olo.mjs +423 -0
  199. package/msg/pa.js +7 -7
  200. package/msg/pa.mjs +423 -0
  201. package/msg/pl.js +7 -7
  202. package/msg/pl.mjs +423 -0
  203. package/msg/pms.js +7 -7
  204. package/msg/pms.mjs +423 -0
  205. package/msg/ps.js +7 -7
  206. package/msg/ps.mjs +423 -0
  207. package/msg/pt-br.js +9 -9
  208. package/msg/pt-br.mjs +423 -0
  209. package/msg/pt.js +7 -7
  210. package/msg/pt.mjs +423 -0
  211. package/msg/ro.js +7 -7
  212. package/msg/ro.mjs +423 -0
  213. package/msg/ru.js +9 -9
  214. package/msg/ru.mjs +423 -0
  215. package/msg/sc.js +7 -7
  216. package/msg/sc.mjs +423 -0
  217. package/msg/sco.js +7 -7
  218. package/msg/sco.mjs +423 -0
  219. package/msg/sd.js +7 -7
  220. package/msg/sd.mjs +423 -0
  221. package/msg/shn.js +7 -7
  222. package/msg/shn.mjs +423 -0
  223. package/msg/si.js +7 -7
  224. package/msg/si.mjs +423 -0
  225. package/msg/sk.js +7 -7
  226. package/msg/sk.mjs +423 -0
  227. package/msg/skr-arab.js +7 -7
  228. package/msg/skr-arab.mjs +423 -0
  229. package/msg/sl.js +7 -7
  230. package/msg/sl.mjs +423 -0
  231. package/msg/smn.js +7 -7
  232. package/msg/smn.mjs +423 -0
  233. package/msg/sq.js +7 -7
  234. package/msg/sq.mjs +423 -0
  235. package/msg/sr-latn.js +7 -7
  236. package/msg/sr-latn.mjs +423 -0
  237. package/msg/sr.js +7 -7
  238. package/msg/sr.mjs +423 -0
  239. package/msg/sv.js +7 -7
  240. package/msg/sv.mjs +423 -0
  241. package/msg/sw.js +7 -7
  242. package/msg/sw.mjs +423 -0
  243. package/msg/ta.js +13 -13
  244. package/msg/ta.mjs +423 -0
  245. package/msg/tcy.js +7 -7
  246. package/msg/tcy.mjs +423 -0
  247. package/msg/tdd.js +10 -10
  248. package/msg/tdd.mjs +423 -0
  249. package/msg/te.js +7 -7
  250. package/msg/te.mjs +423 -0
  251. package/msg/th.js +7 -7
  252. package/msg/th.mjs +423 -0
  253. package/msg/ti.js +7 -7
  254. package/msg/ti.mjs +423 -0
  255. package/msg/tl.js +7 -7
  256. package/msg/tl.mjs +423 -0
  257. package/msg/tlh.js +7 -7
  258. package/msg/tlh.mjs +423 -0
  259. package/msg/tr.js +9 -9
  260. package/msg/tr.mjs +423 -0
  261. package/msg/ug-arab.js +7 -7
  262. package/msg/ug-arab.mjs +423 -0
  263. package/msg/uk.js +7 -7
  264. package/msg/uk.mjs +423 -0
  265. package/msg/ur.js +7 -7
  266. package/msg/ur.mjs +423 -0
  267. package/msg/uz.js +7 -7
  268. package/msg/uz.mjs +423 -0
  269. package/msg/vi.js +10 -10
  270. package/msg/vi.mjs +423 -0
  271. package/msg/xmf.js +7 -7
  272. package/msg/xmf.mjs +423 -0
  273. package/msg/yo.js +7 -7
  274. package/msg/yo.mjs +423 -0
  275. package/msg/zgh.js +7 -7
  276. package/msg/zgh.mjs +423 -0
  277. package/msg/zh-hans.js +8 -8
  278. package/msg/zh-hans.mjs +423 -0
  279. package/msg/zh-hant.js +18 -18
  280. package/msg/zh-hant.mjs +423 -0
  281. package/package.json +12 -2
  282. package/php.js +4 -0
  283. package/php.mjs +6 -0
  284. package/python.js +4 -0
  285. package/python.mjs +6 -0
  286. package/msg/yue.d.ts +0 -8
package/core/block.d.ts CHANGED
@@ -320,6 +320,12 @@ export declare class Block implements IASTNodeLocation {
320
320
  * @internal
321
321
  */
322
322
  getTopStackBlock(): this;
323
+ /**
324
+ * Returns this block if it is a shadow block, or the first non-shadow parent.
325
+ *
326
+ * @internal
327
+ */
328
+ getFirstNonShadowBlock(): this;
323
329
  /**
324
330
  * Find all the blocks that are directly nested inside this one.
325
331
  * Includes value and statement inputs, as well as any following statement.
@@ -20,9 +20,11 @@ export declare class BlockPaster implements IPaster<BlockCopyData, BlockSvg> {
20
20
  * Exported for testing.
21
21
  *
22
22
  * @param block The block to move to an unambiguous location.
23
+ * @param originalPosition The initial coordinate to start searching from,
24
+ * likely the position of the copied block.
23
25
  * @internal
24
26
  */
25
- export declare function moveBlockToNotConflict(block: BlockSvg): void;
27
+ export declare function moveBlockToNotConflict(block: BlockSvg, originalPosition: Coordinate): void;
26
28
  export interface BlockCopyData extends ICopyData {
27
29
  blockState: State;
28
30
  typeCounts: {
@@ -83,7 +83,10 @@ export declare class CommentView implements IRenderedElement {
83
83
  private createResizeHandle;
84
84
  /** Returns the root SVG group element of the comment view. */
85
85
  getSvgRoot(): SVGGElement;
86
- /** Returns the current size of the comment in workspace units. */
86
+ /**
87
+ * Returns the current size of the comment in workspace units.
88
+ * Respects collapsing.
89
+ */
87
90
  getSize(): Size;
88
91
  /**
89
92
  * Sets the size of the comment in workspace units, and updates the view
@@ -38,7 +38,15 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
38
38
  setEditable(editable: boolean): void;
39
39
  /** Returns the root SVG element of this comment. */
40
40
  getSvgRoot(): SVGElement;
41
- /** Returns the bounding rectangle of this comment in workspace coordinates. */
41
+ /**
42
+ * Returns the comment's size in workspace units.
43
+ * Does not respect collapsing.
44
+ */
45
+ getSize(): Size;
46
+ /**
47
+ * Returns the bounding rectangle of this comment in workspace coordinates.
48
+ * Respects collapsing.
49
+ */
42
50
  getBoundingRectangle(): Rect;
43
51
  /** Move the comment by the given amounts in workspace coordinates. */
44
52
  moveBy(dx: number, dy: number, reason?: string[] | undefined): void;
@@ -86,5 +94,7 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
86
94
  toCopyData(): WorkspaceCommentCopyData | null;
87
95
  /** Show a context menu for this comment. */
88
96
  showContextMenu(e: PointerEvent): void;
97
+ /** Snap this comment to the nearest grid point. */
98
+ snapToGrid(): void;
89
99
  }
90
100
  //# sourceMappingURL=rendered_workspace_comment.d.ts.map
@@ -20,11 +20,6 @@ export declare class BlockDragStrategy implements IDragStrategy {
20
20
  private connectionCandidate;
21
21
  private connectionPreviewer;
22
22
  private dragging;
23
- /**
24
- * If this is a shadow block, the offset between this block and the parent
25
- * block, to add to the drag location. In workspace units.
26
- */
27
- private dragOffset;
28
23
  constructor(block: BlockSvg);
29
24
  /** Returns true if the block is currently movable. False otherwise. */
30
25
  isMovable(): boolean;
@@ -33,8 +28,6 @@ export declare class BlockDragStrategy implements IDragStrategy {
33
28
  * from any parent blocks.
34
29
  */
35
30
  startDrag(e?: PointerEvent): void;
36
- /** Starts a drag on a shadow, recording the drag offset. */
37
- private startDraggingShadow;
38
31
  /**
39
32
  * Whether or not we should disconnect the block when a drag is started.
40
33
  *
@@ -93,7 +86,7 @@ export declare class BlockDragStrategy implements IDragStrategy {
93
86
  * Cleans up any state at the end of the drag. Applies any pending
94
87
  * connections.
95
88
  */
96
- endDrag(e?: PointerEvent): void;
89
+ endDrag(): void;
97
90
  /** Connects the given candidate connections. */
98
91
  private applyConnections;
99
92
  /**
package/core/field.d.ts CHANGED
@@ -561,6 +561,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
561
561
  *
562
562
  * @param newValue New value.
563
563
  * @param validatedValue Validated value.
564
+ * @param fireChangeEvent Whether to fire a change event if the value changes.
564
565
  * @returns New value, or an Error object.
565
566
  */
566
567
  private processValidation_;
@@ -605,8 +606,9 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
605
606
  * No-op by default.
606
607
  *
607
608
  * @param _invalidValue The input value that was determined to be invalid.
609
+ * @param _fireChangeEvent Whether to fire a change event if the value changes.
608
610
  */
609
- protected doValueInvalid_(_invalidValue: any): void;
611
+ protected doValueInvalid_(_invalidValue: any, _fireChangeEvent?: boolean): void;
610
612
  /**
611
613
  * Handle a pointerdown event on a field.
612
614
  *
@@ -706,6 +708,17 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
706
708
  * @internal
707
709
  */
708
710
  updateMarkers_(): void;
711
+ /**
712
+ * Subclasses should reimplement this method to construct their Field
713
+ * subclass from a JSON arg object.
714
+ *
715
+ * It is an error to attempt to register a field subclass in the
716
+ * FieldRegistry if that subclass has not overridden this method.
717
+ *
718
+ * @param _options JSON configuration object with properties needed
719
+ * to configure a specific field.
720
+ */
721
+ static fromJson(_options: FieldConfig): Field;
709
722
  }
710
723
  /**
711
724
  * Extra configuration options for the base field.
@@ -714,12 +727,14 @@ export interface FieldConfig {
714
727
  tooltip?: string;
715
728
  }
716
729
  /**
717
- * For use by Field and descendants of Field. Constructors can change
730
+ * Represents an object that has all the prototype properties of the `Field`
731
+ * class. This is necessary because constructors can change
718
732
  * in descendants, though they should contain all of Field's prototype methods.
719
733
  *
720
- * @internal
734
+ * This type should only be used in places where we directly access the prototype
735
+ * of a Field class or subclass.
721
736
  */
722
- export type FieldProto = Pick<typeof Field, 'prototype'>;
737
+ type FieldProto = Pick<typeof Field, 'prototype'>;
723
738
  /**
724
739
  * Represents an error where the field is trying to access its block or
725
740
  * information about its block before it has actually been attached to said
@@ -729,4 +744,5 @@ export declare class UnattachedFieldError extends Error {
729
744
  /** @internal */
730
745
  constructor();
731
746
  }
747
+ export {};
732
748
  //# sourceMappingURL=field.d.ts.map
@@ -88,10 +88,11 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
88
88
  * value while allowing the display text to be handled by the htmlInput_.
89
89
  *
90
90
  * @param _invalidValue The input value that was determined to be invalid.
91
- * This is not used by the text input because its display value is stored
92
- * on the htmlInput_.
91
+ * This is not used by the text input because its display value is stored
92
+ * on the htmlInput_.
93
+ * @param fireChangeEvent Whether to fire a change event if the value changes.
93
94
  */
94
- protected doValueInvalid_(_invalidValue: any): void;
95
+ protected doValueInvalid_(_invalidValue: any, fireChangeEvent?: boolean): void;
95
96
  /**
96
97
  * Called by setValue if the text input is valid. Updates the value of the
97
98
  * field, and updates the text of the field if it is not currently being
@@ -3,10 +3,42 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { Field, FieldProto } from './field.js';
7
- interface RegistryOptions {
6
+ import type { Field, FieldConfig } from './field.js';
7
+ /**
8
+ * When constructing a field from JSON using the registry, the
9
+ * `fromJson` method in this file is called with an options parameter
10
+ * object consisting of the "type" which is the name of the field, and
11
+ * other options that are part of the field's config object.
12
+ *
13
+ * These options are then passed to the field's static `fromJson`
14
+ * method. That method accepts an options parameter with a type that usually
15
+ * extends from FieldConfig, and may or may not have a "type" attribute (in
16
+ * fact, it shouldn't, because we'd overwrite it as described above!)
17
+ *
18
+ * Unfortunately the registry has no way of knowing the actual Field subclass
19
+ * that will be returned from passing in the name of the field. Therefore it
20
+ * also has no way of knowing that the options object not only implements
21
+ * `FieldConfig`, but it also should satisfy the Config that belongs to that
22
+ * specific class's `fromJson` method.
23
+ *
24
+ * Because of this uncertainty, we just give up on type checking the properties
25
+ * passed to the `fromJson` method, and allow arbitrary string keys with
26
+ * unknown types.
27
+ */
28
+ type RegistryOptions = FieldConfig & {
8
29
  type: string;
9
30
  [key: string]: unknown;
31
+ };
32
+ /**
33
+ * Represents the static methods that must be defined on any
34
+ * field that is registered, i.e. the constructor and fromJson methods.
35
+ *
36
+ * Because we don't know which Field subclass will be registered, we
37
+ * are unable to typecheck the parameters of the constructor.
38
+ */
39
+ export interface RegistrableField {
40
+ new (...args: any[]): Field;
41
+ fromJson(options: FieldConfig): Field;
10
42
  }
11
43
  /**
12
44
  * Registers a field type.
@@ -19,7 +51,7 @@ interface RegistryOptions {
19
51
  * @throws {Error} if the type name is empty, the field is already registered,
20
52
  * or the fieldClass is not an object containing a fromJson function.
21
53
  */
22
- export declare function register(type: string, fieldClass: FieldProto): void;
54
+ export declare function register(type: string, fieldClass: RegistrableField): void;
23
55
  /**
24
56
  * Unregisters the field registered with the given type.
25
57
  *
@@ -8,6 +8,7 @@ import { DeleteArea } from './delete_area.js';
8
8
  import { FlyoutButton } from './flyout_button.js';
9
9
  import type { IFlyout } from './interfaces/i_flyout.js';
10
10
  import type { Options } from './options.js';
11
+ import * as blocks from './serialization/blocks.js';
11
12
  import { Coordinate } from './utils/coordinate.js';
12
13
  import { Svg } from './utils/svg.js';
13
14
  import * as toolbox from './utils/toolbox.js';
@@ -505,6 +506,13 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
505
506
  * @returns The new block in the main workspace.
506
507
  */
507
508
  private placeNewBlock;
509
+ /**
510
+ * Serialize a block to JSON.
511
+ *
512
+ * @param block The block to serialize.
513
+ * @returns A serialized representation of the block.
514
+ */
515
+ protected serializeBlock(block: BlockSvg): blocks.State;
508
516
  /**
509
517
  * Positions a block on the target workspace.
510
518
  *
package/core/grid.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { Coordinate } from './utils/coordinate.js';
6
7
  import { GridOptions } from './options.js';
7
8
  /**
8
9
  * Class for a workspace's grid.
@@ -92,6 +93,14 @@ export declare class Grid {
92
93
  * @internal
93
94
  */
94
95
  moveTo(x: number, y: number): void;
96
+ /**
97
+ * Given a coordinate, return the nearest coordinate aligned to the grid.
98
+ *
99
+ * @param xy A workspace coordinate.
100
+ * @returns Workspace coordinate of nearest grid point.
101
+ * If there's no change, return the same coordinate object.
102
+ */
103
+ alignXY(xy: Coordinate): Coordinate;
95
104
  /**
96
105
  * Create the DOM for the grid described by options.
97
106
  *
@@ -9,6 +9,7 @@ import type { Coordinate } from '../utils/coordinate.js';
9
9
  import type { FlyoutDefinition } from '../utils/toolbox.js';
10
10
  import type { Svg } from '../utils/svg.js';
11
11
  import type { IRegistrable } from './i_registrable.js';
12
+ import { FlyoutItem } from '../flyout_base.js';
12
13
  /**
13
14
  * Interface for a flyout.
14
15
  */
@@ -94,6 +95,15 @@ export interface IFlyout extends IRegistrable {
94
95
  * of the dynamic category.
95
96
  */
96
97
  show(flyoutDef: FlyoutDefinition | string): void;
98
+ /**
99
+ * Returns the list of flyout items currently present in the flyout.
100
+ * The `show` method parses the flyout definition into a list of actual
101
+ * flyout items. This method should return those concrete items, which
102
+ * may be used for e.g. keyboard navigation.
103
+ *
104
+ * @returns List of flyout items.
105
+ */
106
+ getContents(): FlyoutItem[];
97
107
  /**
98
108
  * Create a copy of this block on the workspace.
99
109
  *
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @class
11
11
  */
12
- import type { Block } from '../block.js';
12
+ import { Block } from '../block.js';
13
13
  import type { Connection } from '../connection.js';
14
14
  import type { Field } from '../field.js';
15
15
  import type { Input } from '../inputs/input.js';
@@ -127,6 +127,15 @@ export declare class ASTNode {
127
127
  * @returns The next button, or next stack's first block, or null
128
128
  */
129
129
  private navigateFlyoutContents;
130
+ /**
131
+ * Finds the next (or previous if navigating backward) item in the flyout that should be navigated to.
132
+ *
133
+ * @param flyoutContents Contents of the current flyout.
134
+ * @param currentLocation Current ASTNode location.
135
+ * @param forward True if we're navigating forward, else false.
136
+ * @returns The next (or previous) FlyoutItem, or null if there is none.
137
+ */
138
+ private findNextLocationInFlyout;
130
139
  /**
131
140
  * Finds the top most AST node for a given block.
132
141
  * This is either the previous connection, output connection or block
@@ -11,11 +11,22 @@ export declare class LayerManager {
11
11
  private workspace;
12
12
  /** The layer elements being dragged are appended to. */
13
13
  private dragLayer;
14
+ /** The layer elements being animated are appended to. */
15
+ private animationLayer;
14
16
  /** The layers elements not being dragged are appended to. */
15
17
  private layers;
16
18
  /** @internal */
17
19
  constructor(workspace: WorkspaceSvg);
18
20
  private createDragLayer;
21
+ private createAnimationLayer;
22
+ /**
23
+ * Appends the element to the animation layer. The animation layer doesn't
24
+ * move when the workspace moves, so e.g. delete animations don't move
25
+ * when a block delete triggers a workspace resize.
26
+ *
27
+ * @internal
28
+ */
29
+ appendToAnimationLayer(elem: IRenderedElement): void;
19
30
  /**
20
31
  * Translates layers when the workspace is dragged or zoomed.
21
32
  *
package/core.js ADDED
@@ -0,0 +1,4 @@
1
+ // Shim for backwards-compatibility with bundlers that do not
2
+ // support the 'exports' clause in package.json, to allow them
3
+ // to load the blockly/core submodule entrypoint.
4
+ module.exports = require('./blockly_compressed.js');
package/dart.js ADDED
@@ -0,0 +1,4 @@
1
+ // Shim for backwards-compatibility with bundlers that do not
2
+ // support the 'exports' clause in package.json, to allow them
3
+ // to load the blockly/dart submodule entrypoint.
4
+ module.exports = require('./dart_compressed.js');
package/dart.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import dart from './dart_compressed.js';
2
+ export const {
3
+ DartGenerator,
4
+ Order,
5
+ dartGenerator,
6
+ } = dart;
package/index.mjs ADDED
@@ -0,0 +1,143 @@
1
+ import Blockly from './index.js';
2
+ export const {
3
+ ASTNode,
4
+ BasicCursor,
5
+ Block,
6
+ BlockSvg,
7
+ Blocks,
8
+ COLLAPSED_FIELD_NAME,
9
+ COLLAPSED_INPUT_NAME,
10
+ COLLAPSE_CHARS,
11
+ CodeGenerator,
12
+ CollapsibleToolboxCategory,
13
+ ComponentManager,
14
+ Connection,
15
+ ConnectionChecker,
16
+ ConnectionDB,
17
+ ConnectionType,
18
+ ContextMenu,
19
+ ContextMenuItems,
20
+ ContextMenuRegistry,
21
+ Css,
22
+ Cursor,
23
+ DELETE_VARIABLE_ID,
24
+ DeleteArea,
25
+ DragTarget,
26
+ DropDownDiv,
27
+ Events,
28
+ Extensions,
29
+ Field,
30
+ FieldCheckbox,
31
+ FieldDropdown,
32
+ FieldImage,
33
+ FieldLabel,
34
+ FieldLabelSerializable,
35
+ FieldNumber,
36
+ FieldTextInput,
37
+ FieldVariable,
38
+ Flyout,
39
+ FlyoutButton,
40
+ FlyoutMetricsManager,
41
+ Generator,
42
+ Gesture,
43
+ Grid,
44
+ HorizontalFlyout,
45
+ INPUT_VALUE,
46
+ Input,
47
+ InsertionMarkerManager,
48
+ InsertionMarkerPreviewer,
49
+ Marker,
50
+ MarkerManager,
51
+ Menu,
52
+ MenuItem,
53
+ MetricsManager,
54
+ Msg,
55
+ NEXT_STATEMENT,
56
+ Names,
57
+ OPPOSITE_TYPE,
58
+ OUTPUT_VALUE,
59
+ Options,
60
+ PREVIOUS_STATEMENT,
61
+ PROCEDURE_CATEGORY_NAME,
62
+ Procedures,
63
+ RENAME_VARIABLE_ID,
64
+ RenderedConnection,
65
+ Scrollbar,
66
+ ScrollbarPair,
67
+ ShortcutItems,
68
+ ShortcutRegistry,
69
+ TOOLBOX_AT_BOTTOM,
70
+ TOOLBOX_AT_LEFT,
71
+ TOOLBOX_AT_RIGHT,
72
+ TOOLBOX_AT_TOP,
73
+ TabNavigateCursor,
74
+ Theme,
75
+ ThemeManager,
76
+ Themes,
77
+ Toolbox,
78
+ ToolboxCategory,
79
+ ToolboxItem,
80
+ ToolboxSeparator,
81
+ Tooltip,
82
+ Touch,
83
+ Trashcan,
84
+ UnattachedFieldError,
85
+ VARIABLE_CATEGORY_NAME,
86
+ VARIABLE_DYNAMIC_CATEGORY_NAME,
87
+ VERSION,
88
+ VariableMap,
89
+ VariableModel,
90
+ Variables,
91
+ VariablesDynamic,
92
+ VerticalFlyout,
93
+ WidgetDiv,
94
+ Workspace,
95
+ WorkspaceAudio,
96
+ WorkspaceDragger,
97
+ WorkspaceSvg,
98
+ Xml,
99
+ ZoomControls,
100
+ blockAnimations,
101
+ blockRendering,
102
+ browserEvents,
103
+ bubbles,
104
+ bumpObjects,
105
+ clipboard,
106
+ comments,
107
+ common,
108
+ config,
109
+ constants,
110
+ defineBlocksWithJsonArray,
111
+ dialog,
112
+ dragging,
113
+ fieldRegistry,
114
+ geras,
115
+ getMainWorkspace,
116
+ getSelected,
117
+ hasBubble,
118
+ hideChaff,
119
+ icons,
120
+ inject,
121
+ inputs,
122
+ isCopyable,
123
+ isDeletable,
124
+ isDraggable,
125
+ isIcon,
126
+ isObservable,
127
+ isPaster,
128
+ isRenderedElement,
129
+ isSelectable,
130
+ isSerializable,
131
+ isVariableBackedParameterModel,
132
+ procedures,
133
+ registry,
134
+ renderManagement,
135
+ serialization,
136
+ setLocale,
137
+ setParentContainer,
138
+ svgResize,
139
+ thrasos,
140
+ uiPosition,
141
+ utils,
142
+ zelos,
143
+ } = Blockly;
package/javascript.js ADDED
@@ -0,0 +1,4 @@
1
+ // Shim for backwards-compatibility with bundlers that do not
2
+ // support the 'exports' clause in package.json, to allow them
3
+ // to load the blockly/javascript submodule entrypoint.
4
+ module.exports = require('./javascript_compressed.js');
package/javascript.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import javascript from './javascript_compressed.js';
2
+ export const {
3
+ JavascriptGenerator,
4
+ Order,
5
+ javascriptGenerator,
6
+ } = javascript;
package/lua.js ADDED
@@ -0,0 +1,4 @@
1
+ // Shim for backwards-compatibility with bundlers that do not
2
+ // support the 'exports' clause in package.json, to allow them
3
+ // to load the blockly/lua submodule entrypoint.
4
+ module.exports = require('./lua_compressed.js');
package/lua.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import lua from './lua_compressed.js';
2
+ export const {
3
+ LuaGenerator,
4
+ Order,
5
+ luaGenerator,
6
+ } = lua;
@@ -1,3 +1,3 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" height="8" viewBox="0 0 8 8" width="8" fill="#041E49" stroke="#000">
2
- <g><line x1="2.6666666666666665" y1="7" x2="7" y2="2.6666666666666665"></line><line x1="5.333333333333333" y1="7" x2="7" y2="5.333333333333333"></line></g>
2
+ <g><line x1="2.67" y1="7" x2="7" y2="2.67"></line><line x1="5.33" y1="7" x2="7" y2="5.33"></line></g>
3
3
  </svg>
package/msg/ab.js CHANGED
@@ -103,6 +103,7 @@ Blockly.Msg["LISTS_GET_INDEX_FROM_END"] = "№ анҵәамнҭа аҟынтәи
103
103
  Blockly.Msg["LISTS_GET_INDEX_FROM_START"] = "#"; // untranslated
104
104
  Blockly.Msg["LISTS_GET_INDEX_GET"] = "игатәуп";
105
105
  Blockly.Msg["LISTS_GET_INDEX_GET_REMOVE"] = "иалхны ианыхтәуп";
106
+ Blockly.Msg["LISTS_GET_INDEX_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list"; // untranslated
106
107
  Blockly.Msg["LISTS_GET_INDEX_LAST"] = "аҵыхәтәантәи";
107
108
  Blockly.Msg["LISTS_GET_INDEX_RANDOM"] = "иарбанзаалакь";
108
109
  Blockly.Msg["LISTS_GET_INDEX_REMOVE"] = "ианыхтәуп";
@@ -131,7 +132,7 @@ Blockly.Msg["LISTS_GET_SUBLIST_TOOLTIP"] = "Creates a copy of the specified port
131
132
  Blockly.Msg["LISTS_INDEX_FROM_END_TOOLTIP"] = "%1 - аҵыхәтәантәи аелемент.";
132
133
  Blockly.Msg["LISTS_INDEX_FROM_START_TOOLTIP"] = "%1 - актәи аелемент.";
133
134
  Blockly.Msg["LISTS_INDEX_OF_FIRST"] = "find first occurrence of item"; // untranslated
134
- Blockly.Msg["LISTS_INDEX_OF_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list"; // untranslated
135
+ Blockly.Msg["LISTS_INDEX_OF_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#finding-items-in-a-list"; // untranslated
135
136
  Blockly.Msg["LISTS_INDEX_OF_LAST"] = "find last occurrence of item"; // untranslated
136
137
  Blockly.Msg["LISTS_INDEX_OF_TOOLTIP"] = "Returns the index of the first/last occurrence of the item in the list. Returns %1 if item is not found."; // untranslated
137
138
  Blockly.Msg["LISTS_INLIST"] = "ахьӡынҵа аҟны";
@@ -416,7 +417,6 @@ Blockly.Msg["CONTROLS_IF_IF_TITLE_IF"] = Blockly.Msg["CONTROLS_IF_MSG_IF"];
416
417
  Blockly.Msg["CONTROLS_IF_MSG_THEN"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
417
418
  Blockly.Msg["CONTROLS_WHILEUNTIL_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
418
419
  Blockly.Msg["LISTS_CREATE_WITH_ITEM_TITLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
419
- Blockly.Msg["LISTS_GET_INDEX_HELPURL"] = Blockly.Msg["LISTS_INDEX_OF_HELPURL"];
420
420
  Blockly.Msg["LISTS_GET_INDEX_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
421
421
  Blockly.Msg["LISTS_GET_SUBLIST_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
422
422
  Blockly.Msg["LISTS_INDEX_OF_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
@@ -429,14 +429,14 @@ Blockly.Msg["PROCEDURES_DEFRETURN_TITLE"] = Blockly.Msg["PROCEDURES_DEFNORETURN_
429
429
  Blockly.Msg["TEXT_APPEND_VARIABLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
430
430
  Blockly.Msg["TEXT_CREATE_JOIN_ITEM_TITLE_ITEM"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
431
431
 
432
- Blockly.Msg["MATH_HUE"] = "230";
433
- Blockly.Msg["LOOPS_HUE"] = "120";
432
+ Blockly.Msg["COLOUR_HUE"] = "20";
434
433
  Blockly.Msg["LISTS_HUE"] = "260";
435
434
  Blockly.Msg["LOGIC_HUE"] = "210";
436
- Blockly.Msg["VARIABLES_HUE"] = "330";
437
- Blockly.Msg["TEXTS_HUE"] = "160";
435
+ Blockly.Msg["LOOPS_HUE"] = "120";
436
+ Blockly.Msg["MATH_HUE"] = "230";
438
437
  Blockly.Msg["PROCEDURES_HUE"] = "290";
439
- Blockly.Msg["COLOUR_HUE"] = "20";
438
+ Blockly.Msg["TEXTS_HUE"] = "160";
440
439
  Blockly.Msg["VARIABLES_DYNAMIC_HUE"] = "310";
440
+ Blockly.Msg["VARIABLES_HUE"] = "330";
441
441
  return Blockly.Msg;
442
442
  }));