blockly 11.0.0-beta.3 → 11.0.0-beta.4

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 (106) hide show
  1. package/blockly.min.js +364 -398
  2. package/blockly_compressed.js +332 -329
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +18 -20
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +2 -2
  7. package/core/block_dragger.d.ts +66 -4
  8. package/core/blockly.d.ts +6 -6
  9. package/core/comments/comment_view.d.ts +200 -0
  10. package/core/comments/workspace_comment.d.ts +94 -0
  11. package/core/comments.d.ts +8 -0
  12. package/core/events/events_click.d.ts +1 -1
  13. package/core/field_dropdown.d.ts +1 -0
  14. package/core/field_image.d.ts +1 -1
  15. package/core/generator.d.ts +1 -1
  16. package/core/grid.d.ts +29 -8
  17. package/core/icons/comment_icon.d.ts +1 -1
  18. package/core/icons/icon_types.d.ts +2 -2
  19. package/core/insertion_marker_manager.d.ts +2 -0
  20. package/core/insertion_marker_previewer.d.ts +56 -0
  21. package/core/interfaces/i_comment_icon.d.ts +17 -0
  22. package/core/interfaces/i_connection_previewer.d.ts +39 -0
  23. package/core/registry.d.ts +4 -2
  24. package/core/render_management.d.ts +4 -1
  25. package/core/rendered_connection.d.ts +3 -1
  26. package/core/renderers/common/constants.d.ts +6 -2
  27. package/core/renderers/common/drawer.d.ts +18 -0
  28. package/core/renderers/common/i_path_object.d.ts +6 -15
  29. package/core/renderers/common/info.d.ts +5 -2
  30. package/core/renderers/common/path_object.d.ts +13 -0
  31. package/core/renderers/common/renderer.d.ts +3 -0
  32. package/core/renderers/measurables/connection.d.ts +1 -0
  33. package/core/renderers/zelos/drawer.d.ts +4 -0
  34. package/core/renderers/zelos/renderer.d.ts +4 -2
  35. package/core/utils/keycodes.d.ts +32 -32
  36. package/core/utils/size.d.ts +10 -0
  37. package/core/workspace_audio.d.ts +10 -0
  38. package/core/workspace_svg.d.ts +0 -1
  39. package/core-node.js +31 -0
  40. package/dart_compressed.js +18 -68
  41. package/dart_compressed.js.map +1 -1
  42. package/generators/dart/dart_generator.d.ts +17 -17
  43. package/generators/dart/text.d.ts +0 -1
  44. package/generators/javascript/javascript_generator.d.ts +34 -35
  45. package/generators/javascript/text.d.ts +0 -1
  46. package/generators/lua/lua_generator.d.ts +10 -10
  47. package/generators/lua/text.d.ts +0 -1
  48. package/generators/php/php_generator.d.ts +36 -36
  49. package/generators/php/text.d.ts +0 -1
  50. package/generators/python/python_generator.d.ts +20 -21
  51. package/generators/python/text.d.ts +0 -1
  52. package/index.js +19 -7
  53. package/javascript_compressed.js +14 -49
  54. package/javascript_compressed.js.map +1 -1
  55. package/lua_compressed.js +18 -40
  56. package/lua_compressed.js.map +1 -1
  57. package/media/arrow-dropdown.svg +1 -0
  58. package/media/resize-handle.svg +3 -0
  59. package/msg/ar.js +1 -1
  60. package/msg/be-tarask.js +8 -8
  61. package/msg/bn.js +5 -5
  62. package/msg/ce.d.ts +8 -0
  63. package/msg/da.js +4 -4
  64. package/msg/dtp.d.ts +8 -0
  65. package/msg/el.js +1 -1
  66. package/msg/he.js +1 -1
  67. package/msg/hsb.d.ts +8 -0
  68. package/msg/id.js +6 -6
  69. package/msg/inh.js +3 -3
  70. package/msg/ja.js +1 -1
  71. package/msg/nl.js +3 -3
  72. package/msg/pt.js +1 -1
  73. package/msg/ta.js +2 -2
  74. package/msg/tdd.d.ts +8 -0
  75. package/msg/tl.js +2 -2
  76. package/msg/ur.js +2 -2
  77. package/msg/zh-hant.js +14 -14
  78. package/package.json +44 -13
  79. package/php_compressed.js +10 -43
  80. package/php_compressed.js.map +1 -1
  81. package/python_compressed.js +18 -37
  82. package/python_compressed.js.map +1 -1
  83. package/blockly.js +0 -22
  84. package/blocks.js +0 -22
  85. package/browser.js +0 -30
  86. package/core/field_angle.d.ts +0 -208
  87. package/core/field_colour.d.ts +0 -243
  88. package/core/field_multilineinput.d.ts +0 -182
  89. package/core-browser.js +0 -26
  90. package/core.js +0 -26
  91. package/dart.js +0 -22
  92. package/generators/dart/colour.d.ts +0 -16
  93. package/generators/javascript/colour.d.ts +0 -16
  94. package/generators/lua/colour.d.ts +0 -16
  95. package/generators/php/colour.d.ts +0 -16
  96. package/generators/python/colour.d.ts +0 -16
  97. package/javascript.js +0 -23
  98. package/lua.js +0 -22
  99. package/msg/constants.d.ts +0 -14
  100. package/msg/msg.d.ts +0 -440
  101. package/msg/qqq.d.ts +0 -14
  102. package/msg/synonyms.d.ts +0 -14
  103. package/msg/yue.js +0 -441
  104. package/node.js +0 -21
  105. package/php.js +0 -22
  106. package/python.js +0 -23
@@ -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,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { IIcon } from './i_icon.js';
7
+ import { Size } from '../utils/size.js';
8
+ import { IHasBubble } from './i_has_bubble.js';
9
+ export interface ICommentIcon extends IIcon, IHasBubble {
10
+ setText(text: string): void;
11
+ getText(): string;
12
+ setBubbleSize(size: Size): void;
13
+ getBubbleSize(): Size;
14
+ }
15
+ /** Checks whether the given object is an ICommentIcon. */
16
+ export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
17
+ //# 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
@@ -18,8 +18,9 @@ import type { Options } from './options.js';
18
18
  import type { Renderer } from './renderers/common/renderer.js';
19
19
  import type { Theme } from './theme.js';
20
20
  import type { ToolboxItem } from './toolbox/toolbox_item.js';
21
- import { IPaster } from './interfaces/i_paster.js';
22
- import { ICopyable } from './interfaces/i_copyable.js';
21
+ import type { IPaster } from './interfaces/i_paster.js';
22
+ import type { ICopyable } from './interfaces/i_copyable.js';
23
+ import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
23
24
  export declare const TEST_ONLY: {
24
25
  typeMap: {
25
26
  [key: string]: {
@@ -45,6 +46,7 @@ export declare class Type<_T> {
45
46
  */
46
47
  toString(): string;
47
48
  static CONNECTION_CHECKER: Type<IConnectionChecker>;
49
+ static CONNECTION_PREVIEWER: Type<IConnectionPreviewer>;
48
50
  static CURSOR: Type<Cursor>;
49
51
  static EVENT: Type<Abstract>;
50
52
  static FIELD: Type<Field<any>>;
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { BlockSvg } from './block_svg.js';
7
+ import type { WorkspaceSvg } from './workspace_svg.js';
7
8
  /**
8
9
  * Registers that the given block and all of its parents need to be rerendered,
9
10
  * and registers a callback to do so after a delay, to allowf or batching.
@@ -25,7 +26,9 @@ export declare function finishQueuedRenders(): Promise<void>;
25
26
  * cases where queueing renders breaks functionality + backwards compatibility
26
27
  * (such as rendering icons).
27
28
  *
29
+ * @param workspace If provided, only rerender blocks in this workspace.
30
+ *
28
31
  * @internal
29
32
  */
30
- export declare function triggerQueuedRenders(): void;
33
+ export declare function triggerQueuedRenders(workspace?: WorkspaceSvg): void;
31
34
  //# sourceMappingURL=render_management.d.ts.map
@@ -21,7 +21,7 @@ export declare class RenderedConnection extends Connection {
21
21
  private readonly dbOpposite;
22
22
  private readonly offsetInBlock;
23
23
  private trackedState;
24
- private highlightPath;
24
+ private highlighted;
25
25
  /** Connection this connection connects to. Null if not connected. */
26
26
  targetConnection: RenderedConnection | null;
27
27
  /**
@@ -130,6 +130,8 @@ export declare class RenderedConnection extends Connection {
130
130
  highlight(): void;
131
131
  /** Remove the highlighting around this connection. */
132
132
  unhighlight(): void;
133
+ /** Returns true if this connection is highlighted, false otherwise. */
134
+ isHighlighted(): boolean;
133
135
  /**
134
136
  * Set whether this connections is tracked in the database or not.
135
137
  *
@@ -39,8 +39,8 @@ export interface PuzzleTab {
39
39
  type: number;
40
40
  width: number;
41
41
  height: number;
42
- pathDown: string | ((p1: number) => string);
43
- pathUp: string | ((p1: number) => string);
42
+ pathDown: string;
43
+ pathUp: string;
44
44
  }
45
45
  /**
46
46
  * An object containing sizing and path information about collapsed block
@@ -78,6 +78,10 @@ export type Shape = BaseShape | DynamicShape;
78
78
  * @returns Whether the shape is a dynamic shape or not.
79
79
  */
80
80
  export declare function isDynamicShape(shape: Shape): shape is DynamicShape;
81
+ /** Returns whether the shape is a puzzle tab or not. */
82
+ export declare function isPuzzleTab(shape: Shape): shape is PuzzleTab;
83
+ /** Returns whether the shape is a notch or not. */
84
+ export declare function isNotch(shape: Shape): shape is Notch;
81
85
  /**
82
86
  * An object that provides constants for rendering blocks.
83
87
  */
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
7
  import { Coordinate } from '../../utils.js';
8
+ import { Connection } from '../measurables/connection.js';
8
9
  import type { Field } from '../measurables/field.js';
9
10
  import type { Icon } from '../measurables/icon.js';
10
11
  import type { InlineInput } from '../measurables/inline_input.js';
@@ -134,5 +135,22 @@ export declare class Drawer {
134
135
  protected positionNextConnection_(): void;
135
136
  /** Position the output connection on a block. */
136
137
  protected positionOutputConnection_(): void;
138
+ /**
139
+ * Updates the path object to reflect which connections on the block are
140
+ * highlighted.
141
+ */
142
+ protected updateConnectionHighlights(): void;
143
+ /** Returns a path to highlight the given connection. */
144
+ drawConnectionHighlightPath(measurable: Connection): void;
145
+ /**
146
+ * Returns a path to highlight the given conneciton, assuming it is an
147
+ * input or output connection.
148
+ */
149
+ private getExpressionConnectionHighlightPath;
150
+ /**
151
+ * Returns a path to highlight the given conneciton, assuming it is a
152
+ * next or previous connection.
153
+ */
154
+ private getStatementConnectionHighlightPath;
137
155
  }
138
156
  //# sourceMappingURL=drawer.d.ts.map
@@ -6,7 +6,8 @@
6
6
  import type { BlockStyle } from '../../theme.js';
7
7
  import type { BlockSvg } from '../../block_svg.js';
8
8
  import type { ConstantProvider } from './constants.js';
9
- import { RenderedConnection } from '../../rendered_connection.js';
9
+ import type { RenderedConnection } from '../../rendered_connection.js';
10
+ import type { Coordinate } from '../../utils/coordinate.js';
10
11
  /**
11
12
  * An interface for a block's path object.
12
13
  *
@@ -101,21 +102,11 @@ export interface IPathObject {
101
102
  * @param enable True if the block is movable, false otherwise.
102
103
  */
103
104
  updateMovable(enabled: boolean): void;
105
+ /** Adds the given path as a connection highlight for the given connection. */
106
+ addConnectionHighlight?(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean): void;
104
107
  /**
105
- * Add or remove styling that shows that if the dragging block is dropped,
106
- * this block will be replaced. If a shadow block, it will disappear.
107
- * Otherwise it will bump.
108
- *
109
- * @param enable True if styling should be added.
110
- */
111
- updateReplacementFade(enabled: boolean): void;
112
- /**
113
- * Add or remove styling that shows that if the dragging block is dropped,
114
- * this block will be connected to the input.
115
- *
116
- * @param conn The connection on the input to highlight.
117
- * @param enable True if styling should be added.
108
+ * Removes any highlight associated with the given connection, if it exists.
118
109
  */
119
- updateShapeForInputHighlight(conn: RenderedConnection, enable: boolean): void;
110
+ removeConnectionHighlight?(connection: RenderedConnection): void;
120
111
  }
121
112
  //# sourceMappingURL=i_path_object.d.ts.map
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
7
  import { Input } from '../../inputs/input.js';
8
+ import type { RenderedConnection } from '../../rendered_connection.js';
8
9
  import type { Measurable } from '../measurables/base.js';
9
10
  import { BottomRow } from '../measurables/bottom_row.js';
10
11
  import { InputRow } from '../measurables/input_row.js';
@@ -14,6 +15,7 @@ import { SpacerRow } from '../measurables/spacer_row.js';
14
15
  import { TopRow } from '../measurables/top_row.js';
15
16
  import type { ConstantProvider } from './constants.js';
16
17
  import type { Renderer } from './renderer.js';
18
+ import { Connection } from '../measurables/connection.js';
17
19
  /**
18
20
  * An object containing all sizing information needed to draw this block.
19
21
  *
@@ -61,8 +63,7 @@ export declare class RenderInfo {
61
63
  */
62
64
  getRenderer(): Renderer;
63
65
  /**
64
- * Populate and return an object containing all sizing information needed to
65
- * draw this block.
66
+ * Populate this object with all sizing information needed to draw the block.
66
67
  *
67
68
  * This measure pass does not propagate changes to the block (although fields
68
69
  * may choose to rerender when getSize() is called). However, calling it
@@ -194,5 +195,7 @@ export declare class RenderInfo {
194
195
  * store the y position of each row, and record the height of the full block.
195
196
  */
196
197
  protected finalize_(): void;
198
+ /** Returns the connection measurable associated with the given connection. */
199
+ getMeasureableForConnection(conn: RenderedConnection): Connection | null;
197
200
  }
198
201
  //# sourceMappingURL=info.d.ts.map
@@ -5,7 +5,9 @@
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
7
  import type { Connection } from '../../connection.js';
8
+ import { RenderedConnection } from '../../rendered_connection.js';
8
9
  import type { BlockStyle } from '../../theme.js';
10
+ import { Coordinate } from '../../utils/coordinate.js';
9
11
  import type { ConstantProvider } from './constants.js';
10
12
  import type { IPathObject } from './i_path_object.js';
11
13
  /**
@@ -27,6 +29,10 @@ export declare class PathObject implements IPathObject {
27
29
  markerSvg: SVGElement | null;
28
30
  constants: ConstantProvider;
29
31
  style: BlockStyle;
32
+ /** Highlight paths associated with connections. */
33
+ private connectionHighlights;
34
+ /** Locations of connection highlights. */
35
+ private highlightOffsets;
30
36
  /**
31
37
  * @param root The root SVG element.
32
38
  * @param style The style object to use for colouring.
@@ -138,5 +144,12 @@ export declare class PathObject implements IPathObject {
138
144
  * @param _enable True if styling should be added.
139
145
  */
140
146
  updateShapeForInputHighlight(_conn: Connection, _enable: boolean): void;
147
+ /** Adds the given path as a connection highlight for the given connection. */
148
+ addConnectionHighlight(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean): void;
149
+ private currentHighlightMatchesNew;
150
+ /**
151
+ * Removes any highlight associated with the given connection, if it exists.
152
+ */
153
+ removeConnectionHighlight(connection: RenderedConnection): void;
141
154
  }
142
155
  //# sourceMappingURL=path_object.d.ts.map
@@ -141,6 +141,9 @@ export declare class Renderer implements IRegistrable {
141
141
  * @param local The connection currently being dragged.
142
142
  * @param topBlock The block currently being dragged.
143
143
  * @returns The preview type to display.
144
+ *
145
+ * @deprecated v10 - This function is no longer respected. A custom
146
+ * IConnectionPreviewer may be able to fulfill the functionality.
144
147
  */
145
148
  getConnectionPreviewMethod(closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg): PreviewType;
146
149
  /**
@@ -14,6 +14,7 @@ export declare class Connection extends Measurable {
14
14
  connectionModel: RenderedConnection;
15
15
  shape: Shape;
16
16
  isDynamicShape: boolean;
17
+ highlighted: boolean;
17
18
  /**
18
19
  * @param constants The rendering constants provider.
19
20
  * @param connectionModel The connection object on the block that this
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
7
  import { Drawer as BaseDrawer } from '../common/drawer.js';
8
+ import { Connection } from '../measurables/connection.js';
8
9
  import type { InlineInput } from '../measurables/inline_input.js';
9
10
  import type { Row } from '../measurables/row.js';
10
11
  import type { RenderInfo } from './info.js';
@@ -42,6 +43,9 @@ export declare class Drawer extends BaseDrawer {
42
43
  /** Add steps to draw a flat bottom row. */
43
44
  protected drawFlatBottom_(): void;
44
45
  drawInlineInput_(input: InlineInput): void;
46
+ private getInlineInputPath;
45
47
  drawStatementInput_(row: Row): void;
48
+ /** Returns a path to highlight the given connection. */
49
+ drawConnectionHighlightPath(measurable: Connection): void;
46
50
  }
47
51
  //# sourceMappingURL=drawer.d.ts.map
@@ -4,7 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { BlockSvg } from '../../block_svg.js';
7
- import type { Connection } from '../../connection.js';
8
7
  import { InsertionMarkerManager } from '../../insertion_marker_manager.js';
9
8
  import type { Marker } from '../../keyboard_nav/marker.js';
10
9
  import type { RenderedConnection } from '../../rendered_connection.js';
@@ -74,7 +73,10 @@ export declare class Renderer extends BaseRenderer {
74
73
  * @returns The constant provider.
75
74
  */
76
75
  getConstants(): ConstantProvider;
77
- shouldHighlightConnection(conn: Connection): boolean;
76
+ /**
77
+ * @deprecated v10 - This function is no longer respected. A custom
78
+ * IConnectionPreviewer may be able to fulfill the functionality.
79
+ */
78
80
  getConnectionPreviewMethod(closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg): InsertionMarkerManager.PREVIEW_TYPE;
79
81
  }
80
82
  //# sourceMappingURL=renderer.d.ts.map
@@ -16,7 +16,7 @@ export declare enum KeyCodes {
16
16
  MAC_ENTER = 3,
17
17
  BACKSPACE = 8,
18
18
  TAB = 9,
19
- NUM_CENTER = 12,
19
+ NUM_CENTER = 12,// NUMLOCK on FF/Safari Mac
20
20
  ENTER = 13,
21
21
  SHIFT = 16,
22
22
  CTRL = 17,
@@ -25,18 +25,18 @@ export declare enum KeyCodes {
25
25
  CAPS_LOCK = 20,
26
26
  ESC = 27,
27
27
  SPACE = 32,
28
- PAGE_UP = 33,
29
- PAGE_DOWN = 34,
30
- END = 35,
31
- HOME = 36,
32
- LEFT = 37,
33
- UP = 38,
34
- RIGHT = 39,
35
- DOWN = 40,
36
- PLUS_SIGN = 43,
28
+ PAGE_UP = 33,// also NUM_NORTH_EAST
29
+ PAGE_DOWN = 34,// also NUM_SOUTH_EAST
30
+ END = 35,// also NUM_SOUTH_WEST
31
+ HOME = 36,// also NUM_NORTH_WEST
32
+ LEFT = 37,// also NUM_WEST
33
+ UP = 38,// also NUM_NORTH
34
+ RIGHT = 39,// also NUM_EAST
35
+ DOWN = 40,// also NUM_SOUTH
36
+ PLUS_SIGN = 43,// NOT numpad plus
37
37
  PRINT_SCREEN = 44,
38
- INSERT = 45,
39
- DELETE = 46,
38
+ INSERT = 45,// also NUM_INSERT
39
+ DELETE = 46,// also NUM_DELETE
40
40
  ZERO = 48,
41
41
  ONE = 49,
42
42
  TWO = 50,
@@ -47,11 +47,11 @@ export declare enum KeyCodes {
47
47
  SEVEN = 55,
48
48
  EIGHT = 56,
49
49
  NINE = 57,
50
- FF_SEMICOLON = 59,
51
- FF_EQUALS = 61,
52
- FF_DASH = 173,
50
+ FF_SEMICOLON = 59,// Firefox (Gecko) fires this for semicolon instead of 186
51
+ FF_EQUALS = 61,// Firefox (Gecko) fires this for equals instead of 187
52
+ FF_DASH = 173,// Firefox (Gecko) fires this for dash instead of 189
53
53
  FF_HASH = 163,
54
- QUESTION_MARK = 63,
54
+ QUESTION_MARK = 63,// needs localization
55
55
  AT_SIGN = 64,
56
56
  A = 65,
57
57
  B = 66,
@@ -79,7 +79,7 @@ export declare enum KeyCodes {
79
79
  X = 88,
80
80
  Y = 89,
81
81
  Z = 90,
82
- META = 91,
82
+ META = 91,// WIN_KEY_LEFT
83
83
  WIN_KEY_RIGHT = 92,
84
84
  CONTEXT_MENU = 93,
85
85
  NUM_ZERO = 96,
@@ -113,22 +113,22 @@ export declare enum KeyCodes {
113
113
  SCROLL_LOCK = 145,
114
114
  FIRST_MEDIA_KEY = 166,
115
115
  LAST_MEDIA_KEY = 183,
116
- SEMICOLON = 186,
117
- DASH = 189,
118
- EQUALS = 187,
119
- COMMA = 188,
120
- PERIOD = 190,
121
- SLASH = 191,
122
- APOSTROPHE = 192,
123
- TILDE = 192,
124
- SINGLE_QUOTE = 222,
125
- OPEN_SQUARE_BRACKET = 219,
126
- BACKSLASH = 220,
127
- CLOSE_SQUARE_BRACKET = 221,
116
+ SEMICOLON = 186,// needs localization
117
+ DASH = 189,// needs localization
118
+ EQUALS = 187,// needs localization
119
+ COMMA = 188,// needs localization
120
+ PERIOD = 190,// needs localization
121
+ SLASH = 191,// needs localization
122
+ APOSTROPHE = 192,// needs localization
123
+ TILDE = 192,// needs localization
124
+ SINGLE_QUOTE = 222,// needs localization
125
+ OPEN_SQUARE_BRACKET = 219,// needs localization
126
+ BACKSLASH = 220,// needs localization
127
+ CLOSE_SQUARE_BRACKET = 221,// needs localization
128
128
  WIN_KEY = 224,
129
- MAC_FF_META = 224,
130
- MAC_WK_CMD_LEFT = 91,
131
- MAC_WK_CMD_RIGHT = 93,
129
+ MAC_FF_META = 224,// Firefox (Gecko) fires this for the meta key instead of 91
130
+ MAC_WK_CMD_LEFT = 91,// WebKit Left Command key fired, same as META
131
+ MAC_WK_CMD_RIGHT = 93,// WebKit Right Command key fired, different from META
132
132
  WIN_IME = 229,
133
133
  VK_NONAME = 252,
134
134
  PHANTOM = 255
@@ -30,5 +30,15 @@ export declare class Size {
30
30
  * are null.
31
31
  */
32
32
  static equals(a: Size | null, b: Size | null): boolean;
33
+ /**
34
+ * Returns a new size with the maximum width and height values out of both
35
+ * sizes.
36
+ */
37
+ static max(a: Size, b: Size): Size;
38
+ /**
39
+ * Returns a new size with the minimum width and height values out of both
40
+ * sizes.
41
+ */
42
+ static min(a: Size, b: Size): Size;
33
43
  }
34
44
  //# sourceMappingURL=size.d.ts.map
@@ -13,6 +13,8 @@ export declare class WorkspaceAudio {
13
13
  private sounds;
14
14
  /** Time that the last sound was played. */
15
15
  private lastSound_;
16
+ /** Whether the audio is muted or not. */
17
+ private muted;
16
18
  /**
17
19
  * @param parentWorkspace The parent of the workspace this audio object
18
20
  * belongs to, or null.
@@ -47,5 +49,13 @@ export declare class WorkspaceAudio {
47
49
  * @param opt_volume Volume of sound (0-1).
48
50
  */
49
51
  play(name: string, opt_volume?: number): void;
52
+ /**
53
+ * @param muted If true, mute sounds. Otherwise, play them.
54
+ */
55
+ setMuted(muted: boolean): void;
56
+ /**
57
+ * @returns Whether the audio is currently muted or not.
58
+ */
59
+ getMuted(): boolean;
50
60
  }
51
61
  //# sourceMappingURL=workspace_audio.d.ts.map
@@ -948,7 +948,6 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
948
948
  * Get the grid object for this workspace, or null if there is none.
949
949
  *
950
950
  * @returns The grid object for this workspace.
951
- * @internal
952
951
  */
953
952
  getGrid(): Grid | null;
954
953
  /**
package/core-node.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @file Blockly core module wrapper for node.js. This module loads
9
+ * blockly_compressed.js and jsdom, then calls
10
+ * Blockly.utils.xml.injectDependencies to supply needed XML-handling
11
+ * functions to Blocky.
12
+ *
13
+ * Note that, unlike index.js, this file does not get a UMD wrapper.
14
+ * This is because it is only used in node.js environments and so is
15
+ * guaranteed to be loaded as a CJS module.
16
+ */
17
+
18
+ /* eslint-disable */
19
+ 'use strict';
20
+
21
+ const Blockly = require('./blockly_compressed.js');
22
+ const {JSDOM} = require('jsdom');
23
+
24
+ // Override textToDomDocument and provide node.js alternatives to
25
+ // DOMParser and XMLSerializer.
26
+ if (typeof globalThis.document !== 'object') {
27
+ const {window} = new JSDOM(`<!DOCTYPE html>`);
28
+ Blockly.utils.xml.injectDependencies(window);
29
+ }
30
+
31
+ module.exports = Blockly;